[PATCH v2 3/3] arm64: dts: meson: add GPIO line names to ODROID N2/N2+

2021-04-06 Thread Christian Hewitt
From: Hyeonki Hong 

Add GPIO line-name identifiers to the ODROID N2/N2+ common dtsi.

Signed-off-by: Hyeonki Hong 
Signed-off-by: Christian Hewitt 
Reviewed-by: Neil Armstrong 
---
 .../dts/amlogic/meson-g12b-odroid-n2.dtsi | 45 +++
 1 file changed, 45 insertions(+)

diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi 
b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi
index 0a994668e707..473b81c652cf 100644
--- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi
@@ -446,6 +446,51 @@
 };
 
  {
+   gpio-line-names =
+   /* GPIOZ */
+   "", "", "", "", "", "", "", "",
+   "", "", "", "", "", "", "", "",
+   /* GPIOH */
+   "", "", "", "", "", "", "", "",
+   "",
+   /* BOOT */
+   "", "", "", "", "", "", "", "",
+   "", "", "", "", "", "", "", "",
+   /* GPIOC */
+   "", "", "", "", "", "", "", "",
+   /* GPIOA */
+   "PIN_44", /* GPIOA_0 */
+   "PIN_46", /* GPIOA_1 */
+   "PIN_45", /* GPIOA_2 */
+   "PIN_47", /* GPIOA_3 */
+   "PIN_26", /* GPIOA_4 */
+   "", "", "", "", "", "",
+   "PIN_42", /* GPIOA_11 */
+   "PIN_32", /* GPIOA_12 */
+   "PIN_7",  /* GPIOA_13 */
+   "PIN_27", /* GPIOA_14 */
+   "PIN_28", /* GPIOA_15 */
+   /* GPIOX */
+   "PIN_16", /* GPIOX_0 */
+   "PIN_18", /* GPIOX_1 */
+   "PIN_22", /* GPIOX_2 */
+   "PIN_11", /* GPIOX_3 */
+   "PIN_13", /* GPIOX_4 */
+   "PIN_33", /* GPIOX_5 */
+   "PIN_35", /* GPIOX_6 */
+   "PIN_15", /* GPIOX_7 */
+   "PIN_19", /* GPIOX_8 */
+   "PIN_21", /* GPIOX_9 */
+   "PIN_24", /* GPIOX_10 */
+   "PIN_23", /* GPIOX_11 */
+   "PIN_8",  /* GPIOX_12 */
+   "PIN_10", /* GPIOX_13 */
+   "PIN_29", /* GPIOX_14 */
+   "PIN_31", /* GPIOX_15 */
+   "PIN_12", /* GPIOX_16 */
+   "PIN_3",  /* GPIOX_17 */
+   "PIN_5",  /* GPIOX_18 */
+   "PIN_36"; /* GPIOX_19 */
/*
 * WARNING: The USB Hub on the Odroid-N2 needs a reset signal
 * to be turned high in order to be detected by the USB Controller
-- 
2.17.1



[PATCH v2 1/3] arm64: dts: meson: remove extra tab from ODROID N2/N2+ ext_mdio node

2021-04-06 Thread Christian Hewitt
Remove an extra tab from the ext_mdio node in the ODROID N2/N2+ common
dtsi file.

Signed-off-by: Christian Hewitt 
Reviewed-by: Neil Armstrong 
Reviewed-by: Martin Blumenstingl 
---
 arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi 
b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi
index 58ce569b2ace..2f8d574c30c0 100644
--- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi
@@ -410,7 +410,7 @@
 
 _mdio {
external_phy: ethernet-phy@0 {
-   /* Realtek RTL8211F (0x001cc916) */ 
+   /* Realtek RTL8211F (0x001cc916) */
reg = <0>;
max-speed = <1000>;
 
-- 
2.17.1



[PATCH v2 2/3] arm64: dts: meson: add saradc node to ODROID N2/N2+

2021-04-06 Thread Christian Hewitt
From: Hyeonki Hong 

Add the meson saradc node to the ODROID N2/N2+ common dtsi.

Signed-off-by: Hyeonki Hong 
Signed-off-by: Christian Hewitt 
---
 arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi | 5 +
 1 file changed, 5 insertions(+)

diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi 
b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi
index 2f8d574c30c0..0a994668e707 100644
--- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi
@@ -508,6 +508,11 @@
status = "okay";
 };
 
+ {
+   status = "okay";
+   vref-supply = <_1v8>;
+};
+
 /* SD card */
 _emmc_b {
status = "okay";
-- 
2.17.1



[PATCH v2 0/3] arm64: dts: meson: misc ODROID-N2/N2+ changes

2021-04-06 Thread Christian Hewitt
This series cleans-up and submits some minor patches used in HardKernel
Linux 5.10 and 5.11 images for the ODROID N2/N2+, and fixes a stray tab.

Changes since v1:

- Added reviewed-by's on patches 1/3
- Added my Signed-off-by to patches 2/3
- Added missing vref to patch 2
- Rebased on khilman/v5.13/dt64

Christian Hewitt (1):
  arm64: dts: meson: remove extra tab from ODROID N2/N2+ ext_mdio node

Hyeonki Hong (2):
  arm64: dts: meson: add saradc node to ODROID N2/N2+
  arm64: dts: meson: add GPIO line names to ODROID N2/N2+

 .../dts/amlogic/meson-g12b-odroid-n2.dtsi | 52 ++-
 1 file changed, 51 insertions(+), 1 deletion(-)

-- 
2.17.1



[PATCH v2 3/3] arm64: dts: meson: add initial device-tree for MeCool KIII Pro

2021-04-02 Thread Christian Hewitt
MeCool (Videostrong) KIII Pro is based on the Amlogic Q200 reference
board with an S912 chip and the following specs:

- 3GB DDR3 RAM
- 16GB eMMC
- 10/100/1000 Base-T Ethernet
- BCM4335 Wireless (802.11 b/g/n/ac, BT 4.0)
- DVB-C/T/T2/S/S2 (AVL6862TA demod + R912 tuner)
- HDMI 2.0a video
- S/PDIF optical output
- CVBS/Analogue output
- 4x USB 2.0 ports
- IR receiver
- 1x Power button (with integrated blue LED)
- 1x Update/Reset button (underside)
- 1x micro SD card slot

Tested-by: Drazen Spio 
Signed-off-by: Christian Hewitt 
Reviewed-by: Neil Armstrong 
---
 arch/arm64/boot/dts/amlogic/Makefile  |   1 +
 .../dts/amlogic/meson-gxm-mecool-kiii-pro.dts | 113 ++
 2 files changed, 114 insertions(+)
 create mode 100644 arch/arm64/boot/dts/amlogic/meson-gxm-mecool-kiii-pro.dts

diff --git a/arch/arm64/boot/dts/amlogic/Makefile 
b/arch/arm64/boot/dts/amlogic/Makefile
index f8f515c93055..a58ccecfcb55 100644
--- a/arch/arm64/boot/dts/amlogic/Makefile
+++ b/arch/arm64/boot/dts/amlogic/Makefile
@@ -39,6 +39,7 @@ dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905w-p281.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905w-tx3-mini.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905d-libretech-pc.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxm-khadas-vim2.dtb
+dtb-$(CONFIG_ARCH_MESON) += meson-gxm-mecool-kiii-pro.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxm-minix-neo-u9h.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxm-nexbox-a1.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxm-q200.dtb
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxm-mecool-kiii-pro.dts 
b/arch/arm64/boot/dts/amlogic/meson-gxm-mecool-kiii-pro.dts
new file mode 100644
index ..0651756d7fb5
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/meson-gxm-mecool-kiii-pro.dts
@@ -0,0 +1,113 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+
+/*
+ * Author: Christian Hewitt 
+ */
+
+/dts-v1/;
+
+#include "meson-gxm.dtsi"
+#include "meson-gx-p23x-q20x.dtsi"
+#include 
+#include 
+
+/ {
+   compatible = "videostrong,gxm-kiii-pro", "amlogic,s912", 
"amlogic,meson-gxm";
+   model = "MeCool KIII Pro";
+
+   memory@0 {
+   device_type = "memory";
+   reg = <0x0 0x0 0x0 0xC000>;
+   };
+
+   adc-keys {
+   compatible = "adc-keys";
+   io-channels = < 0>;
+   io-channel-names = "buttons";
+   keyup-threshold-microvolt = <171>;
+
+   button-function {
+   label = "Update";
+   linux,code = ;
+   press-threshold-microvolt = <1>;
+   };
+   };
+
+   gpio-keys-polled {
+   compatible = "gpio-keys-polled";
+   #address-cells = <1>;
+   #size-cells = <0>;
+   poll-interval = <100>;
+
+   button@0 {
+   label = "power";
+   linux,code = ;
+   gpios = <_ao GPIOAO_2 GPIO_ACTIVE_LOW>;
+   };
+   };
+
+   leds {
+   compatible = "gpio-leds";
+
+   blue {
+   color = ;
+   function = LED_FUNCTION_POWER;
+   gpios = < GPIODV_24 GPIO_ACTIVE_HIGH>;
+   default-state = "on";
+   panic-indicator;
+   };
+   };
+};
+
+ {
+   pinctrl-0 = <_pins>;
+   pinctrl-names = "default";
+
+   phy-handle = <_phy>;
+
+   amlogic,tx-delay-ns = <2>;
+
+   phy-mode = "rgmii";
+};
+
+_mdio {
+   external_phy: ethernet-phy@0 {
+   /* Realtek RTL8211F (0x001cc916) */
+   reg = <0>;
+   max-speed = <1000>;
+
+   reset-assert-us = <1>;
+   reset-deassert-us = <8>;
+   reset-gpios = < GPIOZ_14 GPIO_ACTIVE_LOW>;
+
+   interrupt-parent = <_intc>;
+   /* MAC_INTR on GPIOZ_15 */
+   interrupts = <25 IRQ_TYPE_LEVEL_LOW>;
+   };
+};
+
+ {
+   linux,rc-map-name = "rc-mecool-kiii-pro";
+};
+
+_emmc_a {
+   brcmf: wifi@1 {
+   reg = <1>;
+   compatible = "brcm,bcm4329-fmac";
+   };
+};
+
+_A {
+   status = "okay";
+   pinctrl-0 = <_a_pins>, <_a_cts_rts_pins>;
+   pinctrl-names = "default";
+   uart-has-rtscts;
+
+   bluetooth {
+   compatible = "brcm,bcm43438-bt";
+   shutdown-gpios = < GPIOX_17 GPIO_ACTIVE_HIGH>;
+   max-speed = <200>;
+   clocks = <>;
+   clock-names = "lpo";
+   };
+};
-- 
2.17.1



[PATCH v2 2/3] arm64: dts: meson: add initial device-tree for MeCool KII Pro

2021-04-02 Thread Christian Hewitt
MeCool (Videostrong) KII Pro is based on the Amlogic P230 reference
board with an S905D chip and the following specs:

- 2GB DDR3 RAM
- 16GB eMMC
- 10/100 Base-T Ethernet
- BCM4335 Wireless (802.11 b/g/n/ac, BT 4.0)
- DVB-C/T/T2/S/S2 (AVL6862TA demod + R848 tuner)
- HDMI 2.0a video
- S/PDIF optical output
- CVBS/Analogue output
- 4x USB 2.0 ports
- IR receiver
- 1x Power button (with integrated blue LED)
- 1x micro SD card slot

Tested-by: Drazen Spio 
Signed-off-by: Christian Hewitt 
Reviewed-by: Neil Armstrong 
---
 arch/arm64/boot/dts/amlogic/Makefile  |  1 +
 .../meson-gxl-s905d-mecool-kii-pro.dts| 86 +++
 2 files changed, 87 insertions(+)
 create mode 100644 
arch/arm64/boot/dts/amlogic/meson-gxl-s905d-mecool-kii-pro.dts

diff --git a/arch/arm64/boot/dts/amlogic/Makefile 
b/arch/arm64/boot/dts/amlogic/Makefile
index aebd49c88719..f8f515c93055 100644
--- a/arch/arm64/boot/dts/amlogic/Makefile
+++ b/arch/arm64/boot/dts/amlogic/Makefile
@@ -29,6 +29,7 @@ dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905x-libretech-cc.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905x-libretech-cc-v2.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905x-nexbox-a95x.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905x-p212.dtb
+dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905d-mecool-kii-pro.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905d-p230.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905d-p231.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905d-phicomm-n1.dtb
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905d-mecool-kii-pro.dts 
b/arch/arm64/boot/dts/amlogic/meson-gxl-s905d-mecool-kii-pro.dts
new file mode 100644
index ..5ab5d3aa0646
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905d-mecool-kii-pro.dts
@@ -0,0 +1,86 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+
+/*
+ * Author: Christian Hewitt 
+ */
+
+/dts-v1/;
+
+#include "meson-gxl-s905d.dtsi"
+#include "meson-gx-p23x-q20x.dtsi"
+#include 
+#include 
+
+/ {
+   compatible = "videostrong,gxl-kii-pro", "amlogic,s905d", 
"amlogic,meson-gxl";
+   model = "MeCool KII Pro";
+
+   adc-keys {
+   compatible = "adc-keys";
+   io-channels = < 0>;
+   io-channel-names = "buttons";
+   keyup-threshold-microvolt = <171>;
+
+   button-function {
+   label = "Update";
+   linux,code = ;
+   press-threshold-microvolt = <1>;
+   };
+   };
+
+   gpio-keys-polled {
+   compatible = "gpio-keys-polled";
+   #address-cells = <1>;
+   #size-cells = <0>;
+   poll-interval = <100>;
+
+   button@0 {
+   label = "power";
+   linux,code = ;
+   gpios = <_ao GPIOAO_2 GPIO_ACTIVE_LOW>;
+   };
+   };
+
+   leds {
+   compatible = "gpio-leds";
+
+   blue {
+   color = ;
+   function = LED_FUNCTION_POWER;
+   gpios = < GPIODV_24 GPIO_ACTIVE_HIGH>;
+   default-state = "on";
+   panic-indicator;
+   };
+   };
+};
+
+ {
+   phy-mode = "rmii";
+   phy-handle = <_phy>;
+};
+
+ {
+   linux,rc-map-name = "rc-mecool-kii-pro";
+};
+
+_emmc_a {
+   brcmf: wifi@1 {
+   reg = <1>;
+   compatible = "brcm,bcm4329-fmac";
+   };
+};
+
+_A {
+   status = "okay";
+   pinctrl-0 = <_a_pins>, <_a_cts_rts_pins>;
+   pinctrl-names = "default";
+   uart-has-rtscts;
+
+   bluetooth {
+   compatible = "brcm,bcm43438-bt";
+   shutdown-gpios = < GPIOX_17 GPIO_ACTIVE_HIGH>;
+   max-speed = <200>;
+   clocks = <>;
+   clock-names = "lpo";
+   };
+};
-- 
2.17.1



[PATCH v2 0/3] arm64: dts: meson: add support for MeCool KII-Pro/KIII-Pro

2021-04-02 Thread Christian Hewitt
This series adds support for the MeCool (Videostrong) KII Pro (GXL)
and KIII Pro (GXM) Android STB devices. These are quite popular due
to the embedded multi-standard tuner card (which is sadly not-yet
supported in the kernel). Both devices closely follow the Amlogic
reference designs with keys/buttons/LED details taken from known-
working vendor kernel device-trees.

Testing was made by Drazen Spio via the LibreELEC forums [0] as I
don't own either device. Since dts files were added to LibreELEC
nightly test images I've seen the number of active installs grow
without reported issues.

[0] https://forum.libreelec.tv/thread/23590-nightbuild-on-mecool-kiii-pro/

Changes since v1:

- Rebased on khilman/v5.13/dt64
- Add ack on bindings from Rob
- Add reviewed-by(s) from Neil

Christian Hewitt (3):
  dt-bindings: arm: amlogic: add MeCool KII/KIII Pro bindings
  arm64: dts: meson: add initial device-tree for MeCool KII Pro
  arm64: dts: meson: add initial device-tree for MeCool KIII Pro

 .../devicetree/bindings/arm/amlogic.yaml  |   2 +
 arch/arm64/boot/dts/amlogic/Makefile  |   2 +
 .../meson-gxl-s905d-mecool-kii-pro.dts|  86 +
 .../dts/amlogic/meson-gxm-mecool-kiii-pro.dts | 113 ++
 4 files changed, 203 insertions(+)
 create mode 100644 
arch/arm64/boot/dts/amlogic/meson-gxl-s905d-mecool-kii-pro.dts
 create mode 100644 arch/arm64/boot/dts/amlogic/meson-gxm-mecool-kiii-pro.dts

-- 
2.17.1



[PATCH v2 1/3] dt-bindings: arm: amlogic: add MeCool KII/KIII Pro bindings

2021-04-02 Thread Christian Hewitt
Add the board bindings for the MeCool (Videostrong Technology Co., Ltd)
KII-Pro (S905D) and KIII-Pro (S912) devices.

Signed-off-by: Christian Hewitt 
Acked-by: Rob Herring 
---
 Documentation/devicetree/bindings/arm/amlogic.yaml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/arm/amlogic.yaml 
b/Documentation/devicetree/bindings/arm/amlogic.yaml
index d24334e1e166..97fb96266344 100644
--- a/Documentation/devicetree/bindings/arm/amlogic.yaml
+++ b/Documentation/devicetree/bindings/arm/amlogic.yaml
@@ -109,6 +109,7 @@ properties:
   - libretech,aml-s905d-pc
   - phicomm,n1
   - smartlabs,sml5442tw
+  - videostrong,gxl-kii-pro
   - const: amlogic,s905d
   - const: amlogic,meson-gxl
 
@@ -123,6 +124,7 @@ properties:
   - minix,neo-u9h
   - nexbox,a1
   - tronsmart,vega-s96
+  - videostrong,gxm-kiii-pro
   - wetek,core2
   - const: amlogic,s912
   - const: amlogic,meson-gxm
-- 
2.17.1



[PATCH 3/3] arm64: dts: meson: add GPIO line names to ODROID N2/N2+

2021-03-29 Thread Christian Hewitt
From: Hyeonki Hong 

Add GPIO line-name identifiers to the ODROID N2/N2+ common dtsi.

Signed-off-by: Hyeonki Hong 
---
 .../dts/amlogic/meson-g12b-odroid-n2.dtsi | 45 +++
 1 file changed, 45 insertions(+)

diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi 
b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi
index 139c12cf9f66..4489715fc4f3 100644
--- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi
@@ -446,6 +446,51 @@
 };
 
  {
+   gpio-line-names =
+   /* GPIOZ */
+   "", "", "", "", "", "", "", "",
+   "", "", "", "", "", "", "", "",
+   /* GPIOH */
+   "", "", "", "", "", "", "", "",
+   "",
+   /* BOOT */
+   "", "", "", "", "", "", "", "",
+   "", "", "", "", "", "", "", "",
+   /* GPIOC */
+   "", "", "", "", "", "", "", "",
+   /* GPIOA */
+   "PIN_44", /* GPIOA_0 */
+   "PIN_46", /* GPIOA_1 */
+   "PIN_45", /* GPIOA_2 */
+   "PIN_47", /* GPIOA_3 */
+   "PIN_26", /* GPIOA_4 */
+   "", "", "", "", "", "",
+   "PIN_42", /* GPIOA_11 */
+   "PIN_32", /* GPIOA_12 */
+   "PIN_7",  /* GPIOA_13 */
+   "PIN_27", /* GPIOA_14 */
+   "PIN_28", /* GPIOA_15 */
+   /* GPIOX */
+   "PIN_16", /* GPIOX_0 */
+   "PIN_18", /* GPIOX_1 */
+   "PIN_22", /* GPIOX_2 */
+   "PIN_11", /* GPIOX_3 */
+   "PIN_13", /* GPIOX_4 */
+   "PIN_33", /* GPIOX_5 */
+   "PIN_35", /* GPIOX_6 */
+   "PIN_15", /* GPIOX_7 */
+   "PIN_19", /* GPIOX_8 */
+   "PIN_21", /* GPIOX_9 */
+   "PIN_24", /* GPIOX_10 */
+   "PIN_23", /* GPIOX_11 */
+   "PIN_8",  /* GPIOX_12 */
+   "PIN_10", /* GPIOX_13 */
+   "PIN_29", /* GPIOX_14 */
+   "PIN_31", /* GPIOX_15 */
+   "PIN_12", /* GPIOX_16 */
+   "PIN_3",  /* GPIOX_17 */
+   "PIN_5",  /* GPIOX_18 */
+   "PIN_36"; /* GPIOX_19 */
/*
 * WARNING: The USB Hub on the Odroid-N2 needs a reset signal
 * to be turned high in order to be detected by the USB Controller
-- 
2.17.1



[PATCH 2/3] arm64: dts: meson: add saradc node to ODROID N2/N2+

2021-03-29 Thread Christian Hewitt
From: Hyeonki Hong 

Add the meson saradc node to the ODROID N2/N2+ common dtsi.

Signed-off-by: Hyeonki Hong 
---
 arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi | 4 
 1 file changed, 4 insertions(+)

diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi 
b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi
index 2f8d574c30c0..139c12cf9f66 100644
--- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi
@@ -508,6 +508,10 @@
status = "okay";
 };
 
+ {
+   status = "okay";
+};
+
 /* SD card */
 _emmc_b {
status = "okay";
-- 
2.17.1



[PATCH 1/3] arm64: dts: meson: remove extra tab from ODROID N2/N2+ ext_mdio node

2021-03-29 Thread Christian Hewitt
Remove an extra tab from the ext_mdio node in the ODROID N2/N2+ common
dtsi file.

Signed-off-by: Christian Hewitt 
---
 arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi 
b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi
index 58ce569b2ace..2f8d574c30c0 100644
--- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi
@@ -410,7 +410,7 @@
 
 _mdio {
external_phy: ethernet-phy@0 {
-   /* Realtek RTL8211F (0x001cc916) */ 
+   /* Realtek RTL8211F (0x001cc916) */
reg = <0>;
max-speed = <1000>;
 
-- 
2.17.1



[PATCH 0/3] arm64: dts: meson: misc ODROID-N2/N2+ changes

2021-03-29 Thread Christian Hewitt
This series cleans-up and submits some minor patches used in HardKernel
Linux 5.10 and 5.11 images for the ODROID N2/N2+, and fixes a stray tab.

Christian Hewitt (1):
  arm64: dts: meson: remove extra tab from ODROID N2/N2+ ext_mdio node

Hyeonki Hong (2):
  arm64: dts: meson: add saradc node to ODROID N2/N2+
  arm64: dts: meson: add GPIO line names to ODROID N2/N2+

 .../dts/amlogic/meson-g12b-odroid-n2.dtsi | 51 ++-
 1 file changed, 50 insertions(+), 1 deletion(-)

-- 
2.17.1



[PATCH 3/3] arm64: dts: meson: add initial device-tree for MeCool KIII Pro

2021-03-29 Thread Christian Hewitt
MeCool (Videostrong) KIII Pro is based on the Amlogic Q200 reference
board with an S912 chip and the following specs:

- 3GB DDR3 RAM
- 16GB eMMC
- 10/100/1000 Base-T Ethernet
- BCM4335 Wireless (802.11 b/g/n/ac, BT 4.0)
- DVB-C/T/T2/S/S2 (AVL6862TA demod + R912 tuner)
- HDMI 2.0a video
- S/PDIF optical output
- CVBS/Analogue output
- 4x USB 2.0 ports
- IR receiver
- 1x Power button (with integrated blue LED)
- 1x Update/Reset button (underside)
- 1x micro SD card slot

Tested-by: Drazen Spio 
Signed-off-by: Christian Hewitt 
---
 arch/arm64/boot/dts/amlogic/Makefile  |   1 +
 .../dts/amlogic/meson-gxm-mecool-kiii-pro.dts | 113 ++
 2 files changed, 114 insertions(+)
 create mode 100644 arch/arm64/boot/dts/amlogic/meson-gxm-mecool-kiii-pro.dts

diff --git a/arch/arm64/boot/dts/amlogic/Makefile 
b/arch/arm64/boot/dts/amlogic/Makefile
index f8f515c93055..a58ccecfcb55 100644
--- a/arch/arm64/boot/dts/amlogic/Makefile
+++ b/arch/arm64/boot/dts/amlogic/Makefile
@@ -39,6 +39,7 @@ dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905w-p281.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905w-tx3-mini.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905d-libretech-pc.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxm-khadas-vim2.dtb
+dtb-$(CONFIG_ARCH_MESON) += meson-gxm-mecool-kiii-pro.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxm-minix-neo-u9h.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxm-nexbox-a1.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxm-q200.dtb
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxm-mecool-kiii-pro.dts 
b/arch/arm64/boot/dts/amlogic/meson-gxm-mecool-kiii-pro.dts
new file mode 100644
index ..0651756d7fb5
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/meson-gxm-mecool-kiii-pro.dts
@@ -0,0 +1,113 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+
+/*
+ * Author: Christian Hewitt 
+ */
+
+/dts-v1/;
+
+#include "meson-gxm.dtsi"
+#include "meson-gx-p23x-q20x.dtsi"
+#include 
+#include 
+
+/ {
+   compatible = "videostrong,gxm-kiii-pro", "amlogic,s912", 
"amlogic,meson-gxm";
+   model = "MeCool KIII Pro";
+
+   memory@0 {
+   device_type = "memory";
+   reg = <0x0 0x0 0x0 0xC000>;
+   };
+
+   adc-keys {
+   compatible = "adc-keys";
+   io-channels = < 0>;
+   io-channel-names = "buttons";
+   keyup-threshold-microvolt = <171>;
+
+   button-function {
+   label = "Update";
+   linux,code = ;
+   press-threshold-microvolt = <1>;
+   };
+   };
+
+   gpio-keys-polled {
+   compatible = "gpio-keys-polled";
+   #address-cells = <1>;
+   #size-cells = <0>;
+   poll-interval = <100>;
+
+   button@0 {
+   label = "power";
+   linux,code = ;
+   gpios = <_ao GPIOAO_2 GPIO_ACTIVE_LOW>;
+   };
+   };
+
+   leds {
+   compatible = "gpio-leds";
+
+   blue {
+   color = ;
+   function = LED_FUNCTION_POWER;
+   gpios = < GPIODV_24 GPIO_ACTIVE_HIGH>;
+   default-state = "on";
+   panic-indicator;
+   };
+   };
+};
+
+ {
+   pinctrl-0 = <_pins>;
+   pinctrl-names = "default";
+
+   phy-handle = <_phy>;
+
+   amlogic,tx-delay-ns = <2>;
+
+   phy-mode = "rgmii";
+};
+
+_mdio {
+   external_phy: ethernet-phy@0 {
+   /* Realtek RTL8211F (0x001cc916) */
+   reg = <0>;
+   max-speed = <1000>;
+
+   reset-assert-us = <1>;
+   reset-deassert-us = <8>;
+   reset-gpios = < GPIOZ_14 GPIO_ACTIVE_LOW>;
+
+   interrupt-parent = <_intc>;
+   /* MAC_INTR on GPIOZ_15 */
+   interrupts = <25 IRQ_TYPE_LEVEL_LOW>;
+   };
+};
+
+ {
+   linux,rc-map-name = "rc-mecool-kiii-pro";
+};
+
+_emmc_a {
+   brcmf: wifi@1 {
+   reg = <1>;
+   compatible = "brcm,bcm4329-fmac";
+   };
+};
+
+_A {
+   status = "okay";
+   pinctrl-0 = <_a_pins>, <_a_cts_rts_pins>;
+   pinctrl-names = "default";
+   uart-has-rtscts;
+
+   bluetooth {
+   compatible = "brcm,bcm43438-bt";
+   shutdown-gpios = < GPIOX_17 GPIO_ACTIVE_HIGH>;
+   max-speed = <200>;
+   clocks = <>;
+   clock-names = "lpo";
+   };
+};
-- 
2.17.1



[PATCH 2/3] arm64: dts: meson: add initial device-tree for MeCool KII Pro

2021-03-29 Thread Christian Hewitt
MeCool (Videostrong) KII Pro is based on the Amlogic P230 reference
board with an S905D chip and the following specs:

- 2GB DDR3 RAM
- 16GB eMMC
- 10/100 Base-T Ethernet
- BCM4335 Wireless (802.11 b/g/n/ac, BT 4.0)
- DVB-C/T/T2/S/S2 (AVL6862TA demod + R848 tuner)
- HDMI 2.0a video
- S/PDIF optical output
- CVBS/Analogue output
- 4x USB 2.0 ports
- IR receiver
- 1x Power button (with integrated blue LED)
- 1x micro SD card slot

Tested-by: Drazen Spio 
Signed-off-by: Christian Hewitt 
---
 arch/arm64/boot/dts/amlogic/Makefile  |  1 +
 .../meson-gxl-s905d-mecool-kii-pro.dts| 86 +++
 2 files changed, 87 insertions(+)
 create mode 100644 
arch/arm64/boot/dts/amlogic/meson-gxl-s905d-mecool-kii-pro.dts

diff --git a/arch/arm64/boot/dts/amlogic/Makefile 
b/arch/arm64/boot/dts/amlogic/Makefile
index aebd49c88719..f8f515c93055 100644
--- a/arch/arm64/boot/dts/amlogic/Makefile
+++ b/arch/arm64/boot/dts/amlogic/Makefile
@@ -29,6 +29,7 @@ dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905x-libretech-cc.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905x-libretech-cc-v2.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905x-nexbox-a95x.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905x-p212.dtb
+dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905d-mecool-kii-pro.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905d-p230.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905d-p231.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905d-phicomm-n1.dtb
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905d-mecool-kii-pro.dts 
b/arch/arm64/boot/dts/amlogic/meson-gxl-s905d-mecool-kii-pro.dts
new file mode 100644
index ..5ab5d3aa0646
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905d-mecool-kii-pro.dts
@@ -0,0 +1,86 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+
+/*
+ * Author: Christian Hewitt 
+ */
+
+/dts-v1/;
+
+#include "meson-gxl-s905d.dtsi"
+#include "meson-gx-p23x-q20x.dtsi"
+#include 
+#include 
+
+/ {
+   compatible = "videostrong,gxl-kii-pro", "amlogic,s905d", 
"amlogic,meson-gxl";
+   model = "MeCool KII Pro";
+
+   adc-keys {
+   compatible = "adc-keys";
+   io-channels = < 0>;
+   io-channel-names = "buttons";
+   keyup-threshold-microvolt = <171>;
+
+   button-function {
+   label = "Update";
+   linux,code = ;
+   press-threshold-microvolt = <1>;
+   };
+   };
+
+   gpio-keys-polled {
+   compatible = "gpio-keys-polled";
+   #address-cells = <1>;
+   #size-cells = <0>;
+   poll-interval = <100>;
+
+   button@0 {
+   label = "power";
+   linux,code = ;
+   gpios = <_ao GPIOAO_2 GPIO_ACTIVE_LOW>;
+   };
+   };
+
+   leds {
+   compatible = "gpio-leds";
+
+   blue {
+   color = ;
+   function = LED_FUNCTION_POWER;
+   gpios = < GPIODV_24 GPIO_ACTIVE_HIGH>;
+   default-state = "on";
+   panic-indicator;
+   };
+   };
+};
+
+ {
+   phy-mode = "rmii";
+   phy-handle = <_phy>;
+};
+
+ {
+   linux,rc-map-name = "rc-mecool-kii-pro";
+};
+
+_emmc_a {
+   brcmf: wifi@1 {
+   reg = <1>;
+   compatible = "brcm,bcm4329-fmac";
+   };
+};
+
+_A {
+   status = "okay";
+   pinctrl-0 = <_a_pins>, <_a_cts_rts_pins>;
+   pinctrl-names = "default";
+   uart-has-rtscts;
+
+   bluetooth {
+   compatible = "brcm,bcm43438-bt";
+   shutdown-gpios = < GPIOX_17 GPIO_ACTIVE_HIGH>;
+   max-speed = <200>;
+   clocks = <>;
+   clock-names = "lpo";
+   };
+};
-- 
2.17.1



[PATCH 1/3] dt-bindings: arm: amlogic: add MeCool KII/KIII Pro bindings

2021-03-29 Thread Christian Hewitt
Add the board bindings for the MeCool (Videostrong Technology Co., Ltd)
KII-Pro (S905D) and KIII-Pro (S912) devices.

Signed-off-by: Christian Hewitt 
---
 Documentation/devicetree/bindings/arm/amlogic.yaml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/arm/amlogic.yaml 
b/Documentation/devicetree/bindings/arm/amlogic.yaml
index d24334e1e166..97fb96266344 100644
--- a/Documentation/devicetree/bindings/arm/amlogic.yaml
+++ b/Documentation/devicetree/bindings/arm/amlogic.yaml
@@ -109,6 +109,7 @@ properties:
   - libretech,aml-s905d-pc
   - phicomm,n1
   - smartlabs,sml5442tw
+  - videostrong,gxl-kii-pro
   - const: amlogic,s905d
   - const: amlogic,meson-gxl
 
@@ -123,6 +124,7 @@ properties:
   - minix,neo-u9h
   - nexbox,a1
   - tronsmart,vega-s96
+  - videostrong,gxm-kiii-pro
   - wetek,core2
   - const: amlogic,s912
   - const: amlogic,meson-gxm
-- 
2.17.1



[PATCH 0/3] arm64: dts: meson: add support for MeCool KII-Pro/KIII-Pro

2021-03-29 Thread Christian Hewitt
This series adds support for the MeCool (Videostrong) KII Pro (GXL)
and KIII Pro (GXM) Android STB devices. These are quite popular due
to the embedded multi-standard tuner card (which is sadly not-yet
supported in the kernel). Both devices closely follow the Amlogic
reference designs with keys/buttons/LED details taken from known-
working vendor kernel device-trees.

Testing was made by Drazen Spio via the LibreELEC forums [0] as I
don't own either device. Since dts files were added to LibreELEC
nightly test images I've seen the number of active installs grow
without reported issues.

[0] https://forum.libreelec.tv/thread/23590-nightbuild-on-mecool-kiii-pro/

Christian Hewitt (3):
  dt-bindings: arm: amlogic: add MeCool KII/KIII Pro bindings
  arm64: dts: meson: add initial device-tree for MeCool KII Pro
  arm64: dts: meson: add initial device-tree for MeCool KIII Pro

 .../devicetree/bindings/arm/amlogic.yaml  |   2 +
 arch/arm64/boot/dts/amlogic/Makefile  |   2 +
 .../meson-gxl-s905d-mecool-kii-pro.dts|  86 +
 .../dts/amlogic/meson-gxm-mecool-kiii-pro.dts | 113 ++
 4 files changed, 203 insertions(+)
 create mode 100644 
arch/arm64/boot/dts/amlogic/meson-gxl-s905d-mecool-kii-pro.dts
 create mode 100644 arch/arm64/boot/dts/amlogic/meson-gxm-mecool-kiii-pro.dts

-- 
2.17.1



[PATCH] media: rc: add keymaps for mecool-kii-pro/kiii-pro remotes

2021-03-29 Thread Christian Hewitt
Add keymaps and bindings for the simple IR (NEC) remotes used with
the MeCool KII-Pro and MeCool KIII-Pro Android STB devices.

Tested-by: Drazen Spio 
Signed-off-by: Christian Hewitt 
---
 .../devicetree/bindings/media/rc.yaml |  2 +
 drivers/media/rc/keymaps/Makefile |  2 +
 drivers/media/rc/keymaps/rc-mecool-kii-pro.c  | 93 +++
 drivers/media/rc/keymaps/rc-mecool-kiii-pro.c | 90 ++
 include/media/rc-map.h|  2 +
 5 files changed, 189 insertions(+)
 create mode 100644 drivers/media/rc/keymaps/rc-mecool-kii-pro.c
 create mode 100644 drivers/media/rc/keymaps/rc-mecool-kiii-pro.c

diff --git a/Documentation/devicetree/bindings/media/rc.yaml 
b/Documentation/devicetree/bindings/media/rc.yaml
index 946441b4e1a5..365ccd5512b2 100644
--- a/Documentation/devicetree/bindings/media/rc.yaml
+++ b/Documentation/devicetree/bindings/media/rc.yaml
@@ -90,6 +90,8 @@ properties:
   - rc-leadtek-y04g0051
   - rc-lme2510
   - rc-manli
+  - rc-mecool-kii-pro
+  - rc-mecool-kiii-pro
   - rc-medion-x10
   - rc-medion-x10-digitainer
   - rc-medion-x10-or2x
diff --git a/drivers/media/rc/keymaps/Makefile 
b/drivers/media/rc/keymaps/Makefile
index b252a1d2ebd6..642e577701e1 100644
--- a/drivers/media/rc/keymaps/Makefile
+++ b/drivers/media/rc/keymaps/Makefile
@@ -67,6 +67,8 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \
rc-leadtek-y04g0051.o \
rc-lme2510.o \
rc-manli.o \
+   rc-mecool-kii-pro.o \
+   rc-mecool-kiii-pro.o \
rc-medion-x10.o \
rc-medion-x10-digitainer.o \
rc-medion-x10-or2x.o \
diff --git a/drivers/media/rc/keymaps/rc-mecool-kii-pro.c 
b/drivers/media/rc/keymaps/rc-mecool-kii-pro.c
new file mode 100644
index ..08ffdd1352ce
--- /dev/null
+++ b/drivers/media/rc/keymaps/rc-mecool-kii-pro.c
@@ -0,0 +1,93 @@
+// SPDX-License-Identifier: GPL-2.0+
+//
+// Copyright (C) 2021 Christian Hewitt 
+
+#include 
+#include 
+
+//
+// Keytable for the Mecool Kii Pro remote control
+//
+
+static struct rc_map_table mecool_kii_pro[] = {
+
+   { 0x59, KEY_POWER },
+   { 0x19, KEY_MUTE },
+
+   { 0x42, KEY_RED },
+   { 0x40, KEY_GREEN },
+   { 0x00, KEY_YELLOW},
+   { 0x03, KEY_BLUE },
+
+   { 0x4a, KEY_REWIND },
+   { 0x48, KEY_FORWARD },
+   { 0x08, KEY_PREVIOUSSONG},
+   { 0x0b, KEY_NEXTSONG},
+
+   { 0x46, KEY_PLAYPAUSE },
+   { 0x44, KEY_STOP },
+   { 0x1f, KEY_FAVORITES},
+   { 0x04, KEY_PVR },
+
+   { 0x4d, KEY_EPG },
+   { 0x02, KEY_INFO },
+   { 0x09, KEY_SUBTITLE },
+   { 0x01, KEY_LANGUAGE }, // AUDIO
+
+   { 0x0d, KEY_HOME },
+   { 0x11, KEY_TV },
+   { 0x45, KEY_MENU },
+   { 0x05, KEY_EXIT },
+
+   { 0x5a, KEY_LEFT },
+   { 0x1b, KEY_RIGHT },
+   { 0x06, KEY_UP },
+   { 0x16, KEY_DOWN },
+   { 0x1a, KEY_OK },
+
+   { 0x13, KEY_VOLUMEUP },
+   { 0x17, KEY_VOLUMEDOWN },
+   { 0x58, KEY_APPSELECT }, // APPS
+   { 0x12, KEY_CONTEXT_MENU }, // MOUSE
+   { 0x55, KEY_CHANNELUP }, // PAGE_UP
+   { 0x15, KEY_CHANNELDOWN }, // PAGE_DOWN
+
+   { 0x52, KEY_1 },
+   { 0x50, KEY_2 },
+   { 0x10, KEY_3 },
+   { 0x56, KEY_4 },
+   { 0x54, KEY_5 },
+   { 0x14, KEY_6 },
+   { 0x4e, KEY_7 },
+   { 0x4c, KEY_8 },
+   { 0x0c, KEY_9 },
+   { 0x18, KEY_WWW },
+   { 0x0f, KEY_0 },
+   { 0x51, KEY_DELETE },
+
+};
+
+static struct rc_map_list mecool_kii_pro_map = {
+   .map = {
+   .scan = mecool_kii_pro,
+   .size = ARRAY_SIZE(mecool_kii_pro),
+   .rc_proto = RC_PROTO_NEC,
+   .name = RC_MAP_MECOOL_KII_PRO,
+   }
+};
+
+static int __init init_rc_map_mecool_kii_pro(void)
+{
+   return rc_map_register(_kii_pro_map);
+}
+
+static void __exit exit_rc_map_mecool_kii_pro(void)
+{
+   rc_map_unregister(_kii_pro_map);
+}
+
+module_init(init_rc_map_mecool_kii_pro)
+module_exit(exit_rc_map_mecool_kii_pro)
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Christian Hewitt 
+
+#include 
+#include 
+
+//
+// Keytable for the Mecool Kiii Pro remote control
+//
+
+static struct rc_map_table mecool_kiii_pro[] = {
+
+   { 0x59, KEY_POWER },
+
+   { 0x52, KEY_1 },
+   { 0x50, KEY_2 },
+   { 0x10, KEY_3 },
+   { 0x56, KEY_4 },
+   { 0x54, KEY_5 },
+   { 0x14, KEY_6 },
+   { 0x4e, KEY_7 },
+   { 0x4c, KEY_8 },
+   { 0x0c, KEY_9 },
+   { 0x02, KEY_INFO },
+   { 0x0f, KEY_0 },
+   { 0x51, KEY_DELETE },
+   { 0x1f, KEY_FAVORITES},
+   { 0x09, KEY_SUBTITLE },
+   { 0x01, KEY_LANGUAGE }, // AUDIO
+
+   { 0x42, KEY_RED },
+   { 0x40, KEY_GREEN },
+   { 0x00, KEY_YELLOW},
+   { 0x03, KEY_BLUE }, // RADIO
+
+   { 0x0d, KEY_HOME },

Re: [PATCH v2 0/5] arm64: dts: meson: add support for ODROID-HC4

2021-02-01 Thread Christian Hewitt


> On 2 Feb 2021, at 4:42 am, Kevin Hilman  wrote:
> 
> Hi Christian,
> 
> Christian Hewitt  writes:
> 
>> This series fixes minor sort-order issues in the Amlogic bindings yaml and
>> dtb Makefile, then converts the existing ODROID-C2 dts into dtsi so we can
>> support its new sister product the ODROID-HC4.
>> 
>> I've also given the devices different audio card names. This is partly
>> cosmetic, but also because HC4 is HDMI-only while C4 can be used with
>> other i2c audio devices via an expansion connector so users may want to
>> use different alsa configs.
>> 
>> Patches to support the spifc chip are still being upstreamed [0] so this
>> will be addressed in a follow up. A WIP patch for the dts change can be
>> found in my amlogic-5.11.y dev branch [1].
>> 
>> For reference, here's dmesg from LibreELEC on 5.11-rc5 [2].
>> 
>> Changes since v1:
>> - fix ODRIOD typo in patch 3
>> - fix SPI-NOT size in patch 5
>> - add Neil's Acks/Reviews
> 
> Could you please rebase this on top of my v5.12/dt64 branch[1]?  This
> has conflicts with some stuff already queued up there.
> 
> Thanks,
> 
> Kevin
> 
> [1] 
> https://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-amlogic.git/log/?h=v5.12/dt64

Oops. v3 sent based on that branch. Thanks.

Christian

[PATCH v3 0/5] arm64: dts: meson: add support for ODROID-HC4

2021-02-01 Thread Christian Hewitt
This series fixes minor sort-order issues in the Amlogic bindings yaml and
dtb Makefile, then converts the existing ODROID-C4 dts into dtsi so we can
support its new sister product the ODROID-HC4.

I've also given the devices different audio card names. This is partly
cosmetic, but also because HC4 is HDMI-only while C4 can be used with
other i2c audio devices via an expansion connector so users may want to
use different alsa configs.

Patches to support the spifc chip are still being upstreamed [0] so this
will be addressed in a follow up. A WIP patch for the dts change can be
found in my amlogic-5.11.y dev branch [1].

For reference, here's dmesg from LibreELEC on 5.11-rc5 [2].

Changes since v2:
- rebase on khilman v5.12/dt64 branch

Changes since v1:
- fix ODRIOD typo in patch 3
- fix SPI-NOT size in patch 5
- add Neil's Acks/Reviews

[0] 
https://patchwork.ozlabs.org/project/linux-mtd/patch/20201220224314.2659-1-andr...@rammhold.de/
[1] https://github.com/chewitt/linux/commits/amlogic-5.11.y
[2] http://ix.io/2NCi

Christian Hewitt (5):
  dt-bindings: arm: amlogic: sort SM1 bindings
  arm64: dts: meson: sort Amlogic dtb Makefile
  arm64: dts: meson: convert meson-sm1-odroid-c4 to dtsi
  dt-bindings: arm: amlogic: add ODROID-HC4 bindings
  arm64: dts: meson: add initial device-tree for ODROID-HC4

 .../devicetree/bindings/arm/amlogic.yaml  |   5 +-
 arch/arm64/boot/dts/amlogic/Makefile  |   3 +-
 .../boot/dts/amlogic/meson-sm1-odroid-c4.dts  | 427 +
 .../boot/dts/amlogic/meson-sm1-odroid-hc4.dts |  96 
 .../boot/dts/amlogic/meson-sm1-odroid.dtsi| 442 ++
 5 files changed, 544 insertions(+), 429 deletions(-)
 create mode 100644 arch/arm64/boot/dts/amlogic/meson-sm1-odroid-hc4.dts
 create mode 100644 arch/arm64/boot/dts/amlogic/meson-sm1-odroid.dtsi

-- 
2.17.1



[PATCH v3 3/5] arm64: dts: meson: convert meson-sm1-odroid-c4 to dtsi

2021-02-01 Thread Christian Hewitt
Convert the ODROID-C4 dts to meson-sm1-odroid.dtsi and C4 board dts in
preparation for adding additional C4 family boards.

Signed-off-by: Christian Hewitt 
Reviewed-by: Neil Armstrong 
---
 .../boot/dts/amlogic/meson-sm1-odroid-c4.dts  | 427 +
 .../boot/dts/amlogic/meson-sm1-odroid.dtsi| 442 ++
 2 files changed, 443 insertions(+), 426 deletions(-)
 create mode 100644 arch/arm64/boot/dts/amlogic/meson-sm1-odroid.dtsi

diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts 
b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts
index 0adccb79540c..b2a4e823c1d8 100644
--- a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts
@@ -5,34 +5,12 @@
 
 /dts-v1/;
 
-#include "meson-sm1.dtsi"
-#include 
-#include 
-#include 
+#include "meson-sm1-odroid.dtsi"
 
 / {
compatible = "hardkernel,odroid-c4", "amlogic,sm1";
model = "Hardkernel ODROID-C4";
 
-   aliases {
-   serial0 = _AO;
-   ethernet0 = 
-   };
-
-   chosen {
-   stdout-path = "serial0:115200n8";
-   };
-
-   memory@0 {
-   device_type = "memory";
-   reg = <0x0 0x0 0x0 0x4000>;
-   };
-
-   emmc_pwrseq: emmc-pwrseq {
-   compatible = "mmc-pwrseq-emmc";
-   reset-gpios = < BOOT_12 GPIO_ACTIVE_LOW>;
-   };
-
leds {
compatible = "gpio-leds";
 
@@ -45,96 +23,6 @@
};
};
 
-   tflash_vdd: regulator-tflash_vdd {
-   compatible = "regulator-fixed";
-
-   regulator-name = "TFLASH_VDD";
-   regulator-min-microvolt = <330>;
-   regulator-max-microvolt = <330>;
-
-   gpio = <_ao GPIOAO_3 GPIO_ACTIVE_HIGH>;
-   enable-active-high;
-   regulator-always-on;
-   };
-
-   tf_io: gpio-regulator-tf_io {
-   compatible = "regulator-gpio";
-
-   regulator-name = "TF_IO";
-   regulator-min-microvolt = <180>;
-   regulator-max-microvolt = <330>;
-
-   gpios = <_ao GPIOAO_6 GPIO_ACTIVE_HIGH>;
-   gpios-states = <0>;
-
-   states = <330 0>,
-<180 1>;
-   };
-
-   flash_1v8: regulator-flash_1v8 {
-   compatible = "regulator-fixed";
-   regulator-name = "FLASH_1V8";
-   regulator-min-microvolt = <180>;
-   regulator-max-microvolt = <180>;
-   vin-supply = <_3v3>;
-   regulator-always-on;
-   };
-
-   main_12v: regulator-main_12v {
-   compatible = "regulator-fixed";
-   regulator-name = "12V";
-   regulator-min-microvolt = <1200>;
-   regulator-max-microvolt = <1200>;
-   regulator-always-on;
-   };
-
-   vcc_5v: regulator-vcc_5v {
-   compatible = "regulator-fixed";
-   regulator-name = "5V";
-   regulator-min-microvolt = <500>;
-   regulator-max-microvolt = <500>;
-   regulator-always-on;
-   vin-supply = <_12v>;
-   };
-
-   vcc_1v8: regulator-vcc_1v8 {
-   compatible = "regulator-fixed";
-   regulator-name = "VCC_1V8";
-   regulator-min-microvolt = <180>;
-   regulator-max-microvolt = <180>;
-   vin-supply = <_3v3>;
-   regulator-always-on;
-   };
-
-   vcc_3v3: regulator-vcc_3v3 {
-   compatible = "regulator-fixed";
-   regulator-name = "VCC_3V3";
-   regulator-min-microvolt = <330>;
-   regulator-max-microvolt = <330>;
-   vin-supply = <_3v3>;
-   regulator-always-on;
-   /* FIXME: actually controlled by VDDCPU_B_EN */
-   };
-
-   vddcpu: regulator-vddcpu {
-   /*
-* MP8756GD Regulator.
-*/
-   compatible = "pwm-regulator";
-
-   regulator-name = "VDDCPU";
-   regulator-min-microvolt = <721000>;
-   regulator-max-microvolt = <1022000>;
-
-   vin-supply = <_12v>;
-
-   pwms = <_AO_cd 1 1250 0>;
-   pwm-dutycycle-range = <100 0>;
-
-   regulator-boot-on;
-   regulator-always-on;
-   };
-
hub_5v: regulator-hub_5v {
 

[PATCH v3 5/5] arm64: dts: meson: add initial device-tree for ODROID-HC4

2021-02-01 Thread Christian Hewitt
ODROID-HC4 is a derivative of the C4 with minor differences:

- 16MB XT25F128B SPI-NOR flash
- 2x SATA ports via ASM1061 PCIe to SATA controller
- 7-pin header with SPI and I2C for 1-inch OLED display and RTC
- 1x USB 2.0 host port

Signed-off-by: Christian Hewitt 
Reviewed-by: Neil Armstrong 
---
 arch/arm64/boot/dts/amlogic/Makefile  |  1 +
 .../boot/dts/amlogic/meson-sm1-odroid-hc4.dts | 96 +++
 2 files changed, 97 insertions(+)
 create mode 100644 arch/arm64/boot/dts/amlogic/meson-sm1-odroid-hc4.dts

diff --git a/arch/arm64/boot/dts/amlogic/Makefile 
b/arch/arm64/boot/dts/amlogic/Makefile
index f3c8a85fe987..78a569d7fa20 100644
--- a/arch/arm64/boot/dts/amlogic/Makefile
+++ b/arch/arm64/boot/dts/amlogic/Makefile
@@ -47,5 +47,6 @@ dtb-$(CONFIG_ARCH_MESON) += meson-gxm-vega-s96.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxm-wetek-core2.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-sm1-khadas-vim3l.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-sm1-odroid-c4.dtb
+dtb-$(CONFIG_ARCH_MESON) += meson-sm1-odroid-hc4.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-sm1-sei610.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-a1-ad401.dtb
diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-hc4.dts 
b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-hc4.dts
new file mode 100644
index ..bf15700c4b15
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-hc4.dts
@@ -0,0 +1,96 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2020 Dongjin Kim 
+ */
+
+/dts-v1/;
+
+#include "meson-sm1-odroid.dtsi"
+
+/ {
+   compatible = "hardkernel,odroid-hc4", "amlogic,sm1";
+   model = "Hardkernel ODROID-HC4";
+
+   aliases {
+   rtc0 = 
+   rtc1 = 
+   };
+
+   fan0: pwm-fan {
+   compatible = "pwm-fan";
+   #cooling-cells = <2>;
+   cooling-min-state = <0>;
+   cooling-max-state = <3>;
+   cooling-levels = <0 120 170 220>;
+   pwms = <_cd 1 4 0>;
+   };
+
+   leds {
+   compatible = "gpio-leds";
+
+   led-blue {
+   color = ;
+   function = LED_FUNCTION_STATUS;
+   gpios = <_ao GPIOAO_11 GPIO_ACTIVE_HIGH>;
+   linux,default-trigger = "heartbeat";
+   panic-indicator;
+   };
+
+   led-red {
+   color = ;
+   function = LED_FUNCTION_POWER;
+   gpios = <_ao GPIOAO_7 GPIO_ACTIVE_HIGH>;
+   default-state = "on";
+   };
+   };
+
+   sound {
+   model = "ODROID-HC4";
+   };
+};
+
+_thermal {
+   cooling-maps {
+   map {
+   trip = <_passive>;
+   cooling-device = < THERMAL_NO_LIMIT 
THERMAL_NO_LIMIT>;
+   };
+   };
+};
+
+ {
+   linux,rc-map-name = "rc-odroid";
+};
+
+ {
+   status = "okay";
+   pinctrl-0 = <_sda_x_pins>, <_sck_x_pins>;
+   pinctrl-names = "default";
+
+   rtc: rtc@51 {
+   status = "okay";
+   compatible = "nxp,pcf8563";
+   reg = <0x51>;
+   wakeup-source;
+   };
+};
+
+ {
+   status = "okay";
+   reset-gpios = < GPIOH_4 GPIO_ACTIVE_LOW>;
+};
+
+_cd {
+   status = "okay";
+   pinctrl-names = "default";
+   pinctrl-0 = <_d_x6_pins>;
+};
+
+_emmc_c {
+   status = "disabled";
+};
+
+ {
+   phys = <_phy0>, <_phy1>;
+   phy-names = "usb2-phy0", "usb2-phy1";
+};
-- 
2.17.1



[PATCH v3 1/5] dt-bindings: arm: amlogic: sort SM1 bindings

2021-02-01 Thread Christian Hewitt
Sort the bindings before adding new SM1 devices.

Signed-off-by: Christian Hewitt 
Acked-by: Neil Armstrong 
---
 Documentation/devicetree/bindings/arm/amlogic.yaml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/arm/amlogic.yaml 
b/Documentation/devicetree/bindings/arm/amlogic.yaml
index 6bef60ddda64..b21ba8ba23dd 100644
--- a/Documentation/devicetree/bindings/arm/amlogic.yaml
+++ b/Documentation/devicetree/bindings/arm/amlogic.yaml
@@ -164,9 +164,9 @@ properties:
   - description: Boards with the Amlogic Meson SM1 S905X3/D3/Y3 SoC
 items:
   - enum:
-  - seirobotics,sei610
-  - khadas,vim3l
   - hardkernel,odroid-c4
+  - khadas,vim3l
+  - seirobotics,sei610
   - const: amlogic,sm1
 
   - description: Boards with the Amlogic Meson A1 A113L SoC
-- 
2.17.1



[PATCH v3 2/5] arm64: dts: meson: sort Amlogic dtb Makefile

2021-02-01 Thread Christian Hewitt
Sort the Makefile before adding new SM1 devices.

Signed-off-by: Christian Hewitt 
Acked-by: Neil Armstrong 
---
 arch/arm64/boot/dts/amlogic/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/amlogic/Makefile 
b/arch/arm64/boot/dts/amlogic/Makefile
index dce41cd3f347..f3c8a85fe987 100644
--- a/arch/arm64/boot/dts/amlogic/Makefile
+++ b/arch/arm64/boot/dts/amlogic/Makefile
@@ -45,7 +45,7 @@ dtb-$(CONFIG_ARCH_MESON) += meson-gxm-rbox-pro.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxm-s912-libretech-pc.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxm-vega-s96.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxm-wetek-core2.dtb
-dtb-$(CONFIG_ARCH_MESON) += meson-sm1-sei610.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-sm1-khadas-vim3l.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-sm1-odroid-c4.dtb
+dtb-$(CONFIG_ARCH_MESON) += meson-sm1-sei610.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-a1-ad401.dtb
-- 
2.17.1



[PATCH v3 4/5] dt-bindings: arm: amlogic: add ODROID-HC4 bindings

2021-02-01 Thread Christian Hewitt
Add the board bindings for the ODROID-HC4 device.

Signed-off-by: Christian Hewitt 
---
 Documentation/devicetree/bindings/arm/amlogic.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/arm/amlogic.yaml 
b/Documentation/devicetree/bindings/arm/amlogic.yaml
index b21ba8ba23dd..5f6769bf45bd 100644
--- a/Documentation/devicetree/bindings/arm/amlogic.yaml
+++ b/Documentation/devicetree/bindings/arm/amlogic.yaml
@@ -165,6 +165,7 @@ properties:
 items:
   - enum:
   - hardkernel,odroid-c4
+  - hardkernel,odroid-hc4
   - khadas,vim3l
   - seirobotics,sei610
   - const: amlogic,sm1
-- 
2.17.1



[PATCH 2/2] arm64: dts: meson: add initial device-tree for Minix NEO U9-H

2021-02-01 Thread Christian Hewitt
Minix NEO U9-H is based on the Amlogic Q200 reference board with an
S912-H chip and the following specs:

- 2GB DDR3 RAM
- 16GB eMMC
- 10/100/1000 Base-T Ethernet
- AP6356S Wireless (802.11 a/b/g/n/ac, BT 4.1)
- RTC chip
- HDMI 2.1 video
- S/PDIF optical output
- ES8323 audio codec
- Analogue headphone output
- 3x USB 2.0 ports (1x OTG)
- IR receiver
- 1x Power LED (white)
- 1x Power button (rear)
- 1x Update/Reset button (underside)
- 1x micro SD card slot

Tested-by: Wes Bradley 
Signed-off-by: Christian Hewitt 
---
 arch/arm64/boot/dts/amlogic/Makefile  |   1 +
 .../dts/amlogic/meson-gxm-minix-neo-u9h.dts   | 120 ++
 2 files changed, 121 insertions(+)
 create mode 100644 arch/arm64/boot/dts/amlogic/meson-gxm-minix-neo-u9h.dts

diff --git a/arch/arm64/boot/dts/amlogic/Makefile 
b/arch/arm64/boot/dts/amlogic/Makefile
index dce41cd3f347..46e67de3d6d2 100644
--- a/arch/arm64/boot/dts/amlogic/Makefile
+++ b/arch/arm64/boot/dts/amlogic/Makefile
@@ -38,6 +38,7 @@ dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905w-p281.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905w-tx3-mini.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905d-libretech-pc.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxm-khadas-vim2.dtb
+dtb-$(CONFIG_ARCH_MESON) += meson-gxm-minix-neo-u9h.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxm-nexbox-a1.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxm-q200.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxm-q201.dtb
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxm-minix-neo-u9h.dts 
b/arch/arm64/boot/dts/amlogic/meson-gxm-minix-neo-u9h.dts
new file mode 100644
index ..a414cd39c2b1
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/meson-gxm-minix-neo-u9h.dts
@@ -0,0 +1,120 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) Christian Hewitt 
+ */
+
+/dts-v1/;
+
+#include "meson-gxm.dtsi"
+#include "meson-gx-p23x-q20x.dtsi"
+#include 
+#include 
+
+/ {
+   compatible = "minix,neo-u9h", "amlogic,s912", "amlogic,meson-gxm";
+   model = "Minix Neo U9-H";
+
+   leds {
+   compatible = "gpio-leds";
+
+   white {
+   color = ;
+   function = LED_FUNCTION_POWER;
+   gpios = <_ao GPIOAO_9 GPIO_ACTIVE_HIGH>;
+   default-state = "on";
+   panic-indicator;
+   };
+   };
+
+   adc-keys {
+   compatible = "adc-keys";
+   io-channels = < 0>;
+   io-channel-names = "buttons";
+   keyup-threshold-microvolt = <171>;
+
+   button-function {
+   label = "update";
+   linux,code = ;
+   press-threshold-microvolt = <1>;
+   };
+   };
+
+   gpio-keys-polled {
+   compatible = "gpio-keys-polled";
+   #address-cells = <1>;
+   #size-cells = <0>;
+   poll-interval = <100>;
+
+   button@0 {
+   label = "power";
+   linux,code = ;
+   gpios = <_ao GPIOAO_2 GPIO_ACTIVE_LOW>;
+   };
+   };
+};
+
+ {
+   pinctrl-0 = <_pins>;
+   pinctrl-names = "default";
+   phy-handle = <_phy>;
+   amlogic,tx-delay-ns = <2>;
+   phy-mode = "rgmii";
+};
+
+_mdio {
+   external_phy: ethernet-phy@0 {
+   /* Realtek RTL8211F (0x001cc916) */
+   reg = <0>;
+   max-speed = <1000>;
+
+   reset-assert-us = <1>;
+   reset-deassert-us = <8>;
+   reset-gpios = < GPIOZ_14 GPIO_ACTIVE_LOW>;
+
+   interrupt-parent = <_intc>;
+   /* MAC_INTR on GPIOZ_15 */
+   interrupts = <25 IRQ_TYPE_LEVEL_LOW>;
+   };
+};
+
+ {
+   linux,rc-map-name = "rc-minix-neo";
+};
+
+_B {
+   status = "okay";
+   pinctrl-0 = <_b_pins>;
+   pinctrl-names = "default";
+
+   rtc: rtc@51 {
+   status = "okay";
+   compatible = "haoyu,hym8563";
+   reg = <0x51>;
+   #clock-cells = <0>;
+   clock-frequency = <32768>;
+   clock-output-names = "xin32k";
+   wakeup-source;
+   };
+};
+
+_emmc_a {
+   brcmf: wifi@1 {
+   reg = <1>;
+   compatible = "brcm,bcm4329-fmac";
+   };
+};
+
+_A {
+   status = "okay";
+   pinctrl-0 = <_a_pins>, <_a_cts_rts_pins>;
+   pinctrl-names = "default";
+   uart-has-rtscts;
+
+   bluetooth {
+   compatible = "brcm,bcm43438-bt";
+   shutdown-gpios = < GPIOX_17 GPIO_ACTIVE_HIGH>;
+   max-speed = <200>;
+   clocks = <>;
+   clock-names = "lpo";
+   };
+};
-- 
2.17.1



[PATCH 1/2] dt-bindings: arm: amlogic: add support for the Minix NEO U9-H

2021-02-01 Thread Christian Hewitt
The Minix NEO U9-H is a small form-factor Android STB based on the
Amlogic Q200 reference board with an S912-H chip.

Signed-off-by: Christian Hewitt 
---
 Documentation/devicetree/bindings/arm/amlogic.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/arm/amlogic.yaml 
b/Documentation/devicetree/bindings/arm/amlogic.yaml
index 6bef60ddda64..dccfc048fb1c 100644
--- a/Documentation/devicetree/bindings/arm/amlogic.yaml
+++ b/Documentation/devicetree/bindings/arm/amlogic.yaml
@@ -120,6 +120,7 @@ properties:
   - khadas,vim2
   - kingnovel,r-box-pro
   - libretech,aml-s912-pc
+  - minix,neo-u9h
   - nexbox,a1
   - tronsmart,vega-s96
   - wetek,core2
-- 
2.17.1



[PATCH] media: rc: add keymap for minix-neo remote

2021-02-01 Thread Christian Hewitt
Add a keymap and bindings for the simple IR (NEC) remote used with
Minix 'NEO' branded Android STB devices.

Signed-off-by: Christian Hewitt 
---
 .../devicetree/bindings/media/rc.yaml |  1 +
 drivers/media/rc/keymaps/Makefile |  1 +
 drivers/media/rc/keymaps/rc-minix-neo.c   | 55 +++
 include/media/rc-map.h|  1 +
 4 files changed, 58 insertions(+)
 create mode 100644 drivers/media/rc/keymaps/rc-minix-neo.c

diff --git a/Documentation/devicetree/bindings/media/rc.yaml 
b/Documentation/devicetree/bindings/media/rc.yaml
index 946441b4e1a5..cbffdd6a470d 100644
--- a/Documentation/devicetree/bindings/media/rc.yaml
+++ b/Documentation/devicetree/bindings/media/rc.yaml
@@ -93,6 +93,7 @@ properties:
   - rc-medion-x10
   - rc-medion-x10-digitainer
   - rc-medion-x10-or2x
+  - rc-minix-neo
   - rc-msi-digivox-ii
   - rc-msi-digivox-iii
   - rc-msi-tvanywhere
diff --git a/drivers/media/rc/keymaps/Makefile 
b/drivers/media/rc/keymaps/Makefile
index b252a1d2ebd6..b7f53f44c5c8 100644
--- a/drivers/media/rc/keymaps/Makefile
+++ b/drivers/media/rc/keymaps/Makefile
@@ -70,6 +70,7 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \
rc-medion-x10.o \
rc-medion-x10-digitainer.o \
rc-medion-x10-or2x.o \
+   rc-minix-neo.o \
rc-msi-digivox-ii.o \
rc-msi-digivox-iii.o \
rc-msi-tvanywhere.o \
diff --git a/drivers/media/rc/keymaps/rc-minix-neo.c 
b/drivers/media/rc/keymaps/rc-minix-neo.c
new file mode 100644
index ..9165af548ff1
--- /dev/null
+++ b/drivers/media/rc/keymaps/rc-minix-neo.c
@@ -0,0 +1,55 @@
+// SPDX-License-Identifier: GPL-2.0+
+//
+// Copyright (C) 2021 Christian Hewitt 
+
+#include 
+#include 
+
+//
+// Keytable for the Minix NEO remote control
+//
+
+static struct rc_map_table minix_neo[] = {
+
+   { 0x118, KEY_POWER },
+
+   { 0x146, KEY_UP },
+   { 0x116, KEY_DOWN },
+   { 0x147, KEY_LEFT },
+   { 0x115, KEY_RIGHT },
+   { 0x155, KEY_ENTER },
+
+   { 0x110, KEY_VOLUMEDOWN },
+   { 0x140, KEY_BACK },
+   { 0x114, KEY_VOLUMEUP },
+
+   { 0x10d, KEY_HOME },
+   { 0x104, KEY_MENU },
+   { 0x112, KEY_CONFIG },
+
+};
+
+static struct rc_map_list minix_neo_map = {
+   .map = {
+   .scan = minix_neo,
+   .size = ARRAY_SIZE(minix_neo),
+   .rc_proto = RC_PROTO_NEC,
+   .name = RC_MAP_MINIX_NEO,
+   }
+};
+
+static int __init init_rc_map_minix_neo(void)
+{
+   return rc_map_register(_neo_map);
+}
+
+static void __exit exit_rc_map_minix_neo(void)
+{
+   rc_map_unregister(_neo_map);
+}
+
+module_init(init_rc_map_minix_neo)
+module_exit(exit_rc_map_minix_neo)
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Christian Hewitt 

[PATCH v2 1/5] dt-bindings: arm: amlogic: sort SM1 bindings

2021-01-30 Thread Christian Hewitt
Sort the bindings before adding new SM1 devices.

Signed-off-by: Christian Hewitt 
Acked-by: Neil Armstrong 
---
 Documentation/devicetree/bindings/arm/amlogic.yaml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/arm/amlogic.yaml 
b/Documentation/devicetree/bindings/arm/amlogic.yaml
index 6bef60ddda64..b21ba8ba23dd 100644
--- a/Documentation/devicetree/bindings/arm/amlogic.yaml
+++ b/Documentation/devicetree/bindings/arm/amlogic.yaml
@@ -164,9 +164,9 @@ properties:
   - description: Boards with the Amlogic Meson SM1 S905X3/D3/Y3 SoC
 items:
   - enum:
-  - seirobotics,sei610
-  - khadas,vim3l
   - hardkernel,odroid-c4
+  - khadas,vim3l
+  - seirobotics,sei610
   - const: amlogic,sm1
 
   - description: Boards with the Amlogic Meson A1 A113L SoC
-- 
2.17.1



[PATCH v2 5/5] arm64: dts: meson: add initial device-tree for ODROID-HC4

2021-01-30 Thread Christian Hewitt
ODROID-HC4 is a derivative of the C4 with minor differences:

- 16MB XT25F128B SPI-NOR flash
- 2x SATA ports via ASM1061 PCIe to SATA controller
- 7-pin header with SPI and I2C for 1-inch OLED display and RTC
- 1x USB 2.0 host port

Signed-off-by: Christian Hewitt 
Reviewed-by: Neil Armstrong 
---
 arch/arm64/boot/dts/amlogic/Makefile  |  1 +
 .../boot/dts/amlogic/meson-sm1-odroid-hc4.dts | 96 +++
 2 files changed, 97 insertions(+)
 create mode 100644 arch/arm64/boot/dts/amlogic/meson-sm1-odroid-hc4.dts

diff --git a/arch/arm64/boot/dts/amlogic/Makefile 
b/arch/arm64/boot/dts/amlogic/Makefile
index f3c8a85fe987..78a569d7fa20 100644
--- a/arch/arm64/boot/dts/amlogic/Makefile
+++ b/arch/arm64/boot/dts/amlogic/Makefile
@@ -47,5 +47,6 @@ dtb-$(CONFIG_ARCH_MESON) += meson-gxm-vega-s96.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxm-wetek-core2.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-sm1-khadas-vim3l.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-sm1-odroid-c4.dtb
+dtb-$(CONFIG_ARCH_MESON) += meson-sm1-odroid-hc4.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-sm1-sei610.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-a1-ad401.dtb
diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-hc4.dts 
b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-hc4.dts
new file mode 100644
index ..bf15700c4b15
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-hc4.dts
@@ -0,0 +1,96 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2020 Dongjin Kim 
+ */
+
+/dts-v1/;
+
+#include "meson-sm1-odroid.dtsi"
+
+/ {
+   compatible = "hardkernel,odroid-hc4", "amlogic,sm1";
+   model = "Hardkernel ODROID-HC4";
+
+   aliases {
+   rtc0 = 
+   rtc1 = 
+   };
+
+   fan0: pwm-fan {
+   compatible = "pwm-fan";
+   #cooling-cells = <2>;
+   cooling-min-state = <0>;
+   cooling-max-state = <3>;
+   cooling-levels = <0 120 170 220>;
+   pwms = <_cd 1 4 0>;
+   };
+
+   leds {
+   compatible = "gpio-leds";
+
+   led-blue {
+   color = ;
+   function = LED_FUNCTION_STATUS;
+   gpios = <_ao GPIOAO_11 GPIO_ACTIVE_HIGH>;
+   linux,default-trigger = "heartbeat";
+   panic-indicator;
+   };
+
+   led-red {
+   color = ;
+   function = LED_FUNCTION_POWER;
+   gpios = <_ao GPIOAO_7 GPIO_ACTIVE_HIGH>;
+   default-state = "on";
+   };
+   };
+
+   sound {
+   model = "ODROID-HC4";
+   };
+};
+
+_thermal {
+   cooling-maps {
+   map {
+   trip = <_passive>;
+   cooling-device = < THERMAL_NO_LIMIT 
THERMAL_NO_LIMIT>;
+   };
+   };
+};
+
+ {
+   linux,rc-map-name = "rc-odroid";
+};
+
+ {
+   status = "okay";
+   pinctrl-0 = <_sda_x_pins>, <_sck_x_pins>;
+   pinctrl-names = "default";
+
+   rtc: rtc@51 {
+   status = "okay";
+   compatible = "nxp,pcf8563";
+   reg = <0x51>;
+   wakeup-source;
+   };
+};
+
+ {
+   status = "okay";
+   reset-gpios = < GPIOH_4 GPIO_ACTIVE_LOW>;
+};
+
+_cd {
+   status = "okay";
+   pinctrl-names = "default";
+   pinctrl-0 = <_d_x6_pins>;
+};
+
+_emmc_c {
+   status = "disabled";
+};
+
+ {
+   phys = <_phy0>, <_phy1>;
+   phy-names = "usb2-phy0", "usb2-phy1";
+};
-- 
2.17.1



[PATCH v2 3/5] arm64: dts: meson: convert meson-sm1-odroid-c4 to dtsi

2021-01-30 Thread Christian Hewitt
Convert the ODROID-C4 dts to meson-sm1-odroid.dtsi and C4 board dts in
preparation for adding additional C4 family boards.

Signed-off-by: Christian Hewitt 
Reviewed-by: Neil Armstrong 
---
 .../boot/dts/amlogic/meson-sm1-odroid-c4.dts  | 427 +
 .../boot/dts/amlogic/meson-sm1-odroid.dtsi| 441 ++
 2 files changed, 442 insertions(+), 426 deletions(-)
 create mode 100644 arch/arm64/boot/dts/amlogic/meson-sm1-odroid.dtsi

diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts 
b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts
index eadd75e6e067..b2a4e823c1d8 100644
--- a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts
@@ -5,34 +5,12 @@
 
 /dts-v1/;
 
-#include "meson-sm1.dtsi"
-#include 
-#include 
-#include 
+#include "meson-sm1-odroid.dtsi"
 
 / {
compatible = "hardkernel,odroid-c4", "amlogic,sm1";
model = "Hardkernel ODROID-C4";
 
-   aliases {
-   serial0 = _AO;
-   ethernet0 = 
-   };
-
-   chosen {
-   stdout-path = "serial0:115200n8";
-   };
-
-   memory@0 {
-   device_type = "memory";
-   reg = <0x0 0x0 0x0 0x4000>;
-   };
-
-   emmc_pwrseq: emmc-pwrseq {
-   compatible = "mmc-pwrseq-emmc";
-   reset-gpios = < BOOT_12 GPIO_ACTIVE_LOW>;
-   };
-
leds {
compatible = "gpio-leds";
 
@@ -45,96 +23,6 @@
};
};
 
-   tflash_vdd: regulator-tflash_vdd {
-   compatible = "regulator-fixed";
-
-   regulator-name = "TFLASH_VDD";
-   regulator-min-microvolt = <330>;
-   regulator-max-microvolt = <330>;
-
-   gpio = <_ao GPIOAO_3 GPIO_OPEN_DRAIN>;
-   enable-active-high;
-   regulator-always-on;
-   };
-
-   tf_io: gpio-regulator-tf_io {
-   compatible = "regulator-gpio";
-
-   regulator-name = "TF_IO";
-   regulator-min-microvolt = <180>;
-   regulator-max-microvolt = <330>;
-
-   gpios = <_ao GPIOAO_6 GPIO_ACTIVE_HIGH>;
-   gpios-states = <0>;
-
-   states = <330 0>,
-<180 1>;
-   };
-
-   flash_1v8: regulator-flash_1v8 {
-   compatible = "regulator-fixed";
-   regulator-name = "FLASH_1V8";
-   regulator-min-microvolt = <180>;
-   regulator-max-microvolt = <180>;
-   vin-supply = <_3v3>;
-   regulator-always-on;
-   };
-
-   main_12v: regulator-main_12v {
-   compatible = "regulator-fixed";
-   regulator-name = "12V";
-   regulator-min-microvolt = <1200>;
-   regulator-max-microvolt = <1200>;
-   regulator-always-on;
-   };
-
-   vcc_5v: regulator-vcc_5v {
-   compatible = "regulator-fixed";
-   regulator-name = "5V";
-   regulator-min-microvolt = <500>;
-   regulator-max-microvolt = <500>;
-   regulator-always-on;
-   vin-supply = <_12v>;
-   };
-
-   vcc_1v8: regulator-vcc_1v8 {
-   compatible = "regulator-fixed";
-   regulator-name = "VCC_1V8";
-   regulator-min-microvolt = <180>;
-   regulator-max-microvolt = <180>;
-   vin-supply = <_3v3>;
-   regulator-always-on;
-   };
-
-   vcc_3v3: regulator-vcc_3v3 {
-   compatible = "regulator-fixed";
-   regulator-name = "VCC_3V3";
-   regulator-min-microvolt = <330>;
-   regulator-max-microvolt = <330>;
-   vin-supply = <_3v3>;
-   regulator-always-on;
-   /* FIXME: actually controlled by VDDCPU_B_EN */
-   };
-
-   vddcpu: regulator-vddcpu {
-   /*
-* MP8756GD Regulator.
-*/
-   compatible = "pwm-regulator";
-
-   regulator-name = "VDDCPU";
-   regulator-min-microvolt = <721000>;
-   regulator-max-microvolt = <1022000>;
-
-   vin-supply = <_12v>;
-
-   pwms = <_AO_cd 1 1250 0>;
-   pwm-dutycycle-range = <100 0>;
-
-   regulator-boot-on;
-   regulator-always-on;
-   };
-
hub_5v: regulator-hub_5v {
 

[PATCH v2 4/5] dt-bindings: arm: amlogic: add ODROID-HC4 bindings

2021-01-30 Thread Christian Hewitt
Add the board bindings for the ODROID-HC4 device.

Signed-off-by: Christian Hewitt 
---
 Documentation/devicetree/bindings/arm/amlogic.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/arm/amlogic.yaml 
b/Documentation/devicetree/bindings/arm/amlogic.yaml
index b21ba8ba23dd..5f6769bf45bd 100644
--- a/Documentation/devicetree/bindings/arm/amlogic.yaml
+++ b/Documentation/devicetree/bindings/arm/amlogic.yaml
@@ -165,6 +165,7 @@ properties:
 items:
   - enum:
   - hardkernel,odroid-c4
+  - hardkernel,odroid-hc4
   - khadas,vim3l
   - seirobotics,sei610
   - const: amlogic,sm1
-- 
2.17.1



[PATCH v2 2/5] arm64: dts: meson: sort Amlogic dtb Makefile

2021-01-30 Thread Christian Hewitt
Sort the Makefile before adding new SM1 devices.

Signed-off-by: Christian Hewitt 
Acked-by: Neil Armstrong 
---
 arch/arm64/boot/dts/amlogic/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/amlogic/Makefile 
b/arch/arm64/boot/dts/amlogic/Makefile
index dce41cd3f347..f3c8a85fe987 100644
--- a/arch/arm64/boot/dts/amlogic/Makefile
+++ b/arch/arm64/boot/dts/amlogic/Makefile
@@ -45,7 +45,7 @@ dtb-$(CONFIG_ARCH_MESON) += meson-gxm-rbox-pro.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxm-s912-libretech-pc.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxm-vega-s96.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxm-wetek-core2.dtb
-dtb-$(CONFIG_ARCH_MESON) += meson-sm1-sei610.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-sm1-khadas-vim3l.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-sm1-odroid-c4.dtb
+dtb-$(CONFIG_ARCH_MESON) += meson-sm1-sei610.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-a1-ad401.dtb
-- 
2.17.1



[PATCH v2 0/5] arm64: dts: meson: add support for ODROID-HC4

2021-01-30 Thread Christian Hewitt
This series fixes minor sort-order issues in the Amlogic bindings yaml and
dtb Makefile, then converts the existing ODROID-C2 dts into dtsi so we can
support its new sister product the ODROID-HC4.

I've also given the devices different audio card names. This is partly
cosmetic, but also because HC4 is HDMI-only while C4 can be used with
other i2c audio devices via an expansion connector so users may want to
use different alsa configs.

Patches to support the spifc chip are still being upstreamed [0] so this
will be addressed in a follow up. A WIP patch for the dts change can be
found in my amlogic-5.11.y dev branch [1].

For reference, here's dmesg from LibreELEC on 5.11-rc5 [2].

Changes since v1:
- fix ODRIOD typo in patch 3
- fix SPI-NOT size in patch 5
- add Neil's Acks/Reviews

[0] 
https://patchwork.ozlabs.org/project/linux-mtd/patch/20201220224314.2659-1-andr...@rammhold.de/
[1] https://github.com/chewitt/linux/commits/amlogic-5.11.y
[2] http://ix.io/2NCi

Christian Hewitt (5):
  dt-bindings: arm: amlogic: sort SM1 bindings
  arm64: dts: meson: sort Amlogic dtb Makefile
  arm64: dts: meson: convert meson-sm1-odroid-c4 to dtsi
  dt-bindings: arm: amlogic: add ODROID-HC4 bindings
  arm64: dts: meson: add initial device-tree for ODROID-HC4

 .../devicetree/bindings/arm/amlogic.yaml  |   5 +-
 arch/arm64/boot/dts/amlogic/Makefile  |   3 +-
 .../boot/dts/amlogic/meson-sm1-odroid-c4.dts  | 427 +
 .../boot/dts/amlogic/meson-sm1-odroid-hc4.dts |  96 
 .../boot/dts/amlogic/meson-sm1-odroid.dtsi| 441 ++
 5 files changed, 543 insertions(+), 429 deletions(-)
 create mode 100644 arch/arm64/boot/dts/amlogic/meson-sm1-odroid-hc4.dts
 create mode 100644 arch/arm64/boot/dts/amlogic/meson-sm1-odroid.dtsi

-- 
2.17.1



Re: [PATCH 5/5] arm64: dts: meson: add initial device-tree for ODROID-HC4

2021-01-28 Thread Christian Hewitt


> On 29 Jan 2021, at 10:51 am, Christian Hewitt  
> wrote:
> 
> ODROID-HC4 is a derivative of the C4 with minor differences:
> 
> - 128MB SPI-NOR flash

^ should be 16MB, I forgot to amend. I can send a v2 series if needed.

HC4:~ # dmesg | grep spi
[0.453235] spi-nor spi0.0: xt25f128b (16384 Kbytes)

Christian



[PATCH 3/5] arm64: dts: meson: convert meson-sm1-odroid-c4 to dtsi

2021-01-28 Thread Christian Hewitt
Convert the ODRIOD-C4 dts to meson-sm1-odroid.dtsi and C4 board dts in
preparation for adding additional C4 family boards.

Signed-off-by: Christian Hewitt 
---
 .../boot/dts/amlogic/meson-sm1-odroid-c4.dts  | 427 +
 .../boot/dts/amlogic/meson-sm1-odroid.dtsi| 441 ++
 2 files changed, 442 insertions(+), 426 deletions(-)
 create mode 100644 arch/arm64/boot/dts/amlogic/meson-sm1-odroid.dtsi

diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts 
b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts
index eadd75e6e067..b2a4e823c1d8 100644
--- a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts
@@ -5,34 +5,12 @@
 
 /dts-v1/;
 
-#include "meson-sm1.dtsi"
-#include 
-#include 
-#include 
+#include "meson-sm1-odroid.dtsi"
 
 / {
compatible = "hardkernel,odroid-c4", "amlogic,sm1";
model = "Hardkernel ODROID-C4";
 
-   aliases {
-   serial0 = _AO;
-   ethernet0 = 
-   };
-
-   chosen {
-   stdout-path = "serial0:115200n8";
-   };
-
-   memory@0 {
-   device_type = "memory";
-   reg = <0x0 0x0 0x0 0x4000>;
-   };
-
-   emmc_pwrseq: emmc-pwrseq {
-   compatible = "mmc-pwrseq-emmc";
-   reset-gpios = < BOOT_12 GPIO_ACTIVE_LOW>;
-   };
-
leds {
compatible = "gpio-leds";
 
@@ -45,96 +23,6 @@
};
};
 
-   tflash_vdd: regulator-tflash_vdd {
-   compatible = "regulator-fixed";
-
-   regulator-name = "TFLASH_VDD";
-   regulator-min-microvolt = <330>;
-   regulator-max-microvolt = <330>;
-
-   gpio = <_ao GPIOAO_3 GPIO_OPEN_DRAIN>;
-   enable-active-high;
-   regulator-always-on;
-   };
-
-   tf_io: gpio-regulator-tf_io {
-   compatible = "regulator-gpio";
-
-   regulator-name = "TF_IO";
-   regulator-min-microvolt = <180>;
-   regulator-max-microvolt = <330>;
-
-   gpios = <_ao GPIOAO_6 GPIO_ACTIVE_HIGH>;
-   gpios-states = <0>;
-
-   states = <330 0>,
-<180 1>;
-   };
-
-   flash_1v8: regulator-flash_1v8 {
-   compatible = "regulator-fixed";
-   regulator-name = "FLASH_1V8";
-   regulator-min-microvolt = <180>;
-   regulator-max-microvolt = <180>;
-   vin-supply = <_3v3>;
-   regulator-always-on;
-   };
-
-   main_12v: regulator-main_12v {
-   compatible = "regulator-fixed";
-   regulator-name = "12V";
-   regulator-min-microvolt = <1200>;
-   regulator-max-microvolt = <1200>;
-   regulator-always-on;
-   };
-
-   vcc_5v: regulator-vcc_5v {
-   compatible = "regulator-fixed";
-   regulator-name = "5V";
-   regulator-min-microvolt = <500>;
-   regulator-max-microvolt = <500>;
-   regulator-always-on;
-   vin-supply = <_12v>;
-   };
-
-   vcc_1v8: regulator-vcc_1v8 {
-   compatible = "regulator-fixed";
-   regulator-name = "VCC_1V8";
-   regulator-min-microvolt = <180>;
-   regulator-max-microvolt = <180>;
-   vin-supply = <_3v3>;
-   regulator-always-on;
-   };
-
-   vcc_3v3: regulator-vcc_3v3 {
-   compatible = "regulator-fixed";
-   regulator-name = "VCC_3V3";
-   regulator-min-microvolt = <330>;
-   regulator-max-microvolt = <330>;
-   vin-supply = <_3v3>;
-   regulator-always-on;
-   /* FIXME: actually controlled by VDDCPU_B_EN */
-   };
-
-   vddcpu: regulator-vddcpu {
-   /*
-* MP8756GD Regulator.
-*/
-   compatible = "pwm-regulator";
-
-   regulator-name = "VDDCPU";
-   regulator-min-microvolt = <721000>;
-   regulator-max-microvolt = <1022000>;
-
-   vin-supply = <_12v>;
-
-   pwms = <_AO_cd 1 1250 0>;
-   pwm-dutycycle-range = <100 0>;
-
-   regulator-boot-on;
-   regulator-always-on;
-   };
-
hub_5v: regulator-hub_5v {
compatible = "regulator-fixed";
 

[PATCH 2/5] arm64: dts: meson: sort Amlogic dtb Makefile

2021-01-28 Thread Christian Hewitt
Sort the Makefile before adding new SM1 devices.

Signed-off-by: Christian Hewitt 
---
 arch/arm64/boot/dts/amlogic/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/amlogic/Makefile 
b/arch/arm64/boot/dts/amlogic/Makefile
index dce41cd3f347..f3c8a85fe987 100644
--- a/arch/arm64/boot/dts/amlogic/Makefile
+++ b/arch/arm64/boot/dts/amlogic/Makefile
@@ -45,7 +45,7 @@ dtb-$(CONFIG_ARCH_MESON) += meson-gxm-rbox-pro.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxm-s912-libretech-pc.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxm-vega-s96.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxm-wetek-core2.dtb
-dtb-$(CONFIG_ARCH_MESON) += meson-sm1-sei610.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-sm1-khadas-vim3l.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-sm1-odroid-c4.dtb
+dtb-$(CONFIG_ARCH_MESON) += meson-sm1-sei610.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-a1-ad401.dtb
-- 
2.17.1



[PATCH 5/5] arm64: dts: meson: add initial device-tree for ODROID-HC4

2021-01-28 Thread Christian Hewitt
ODROID-HC4 is a derivative of the C4 with minor differences:

- 128MB SPI-NOR flash
- 2x SATA ports via ASM1061 PCIe to SATA controller
- 7-pin header with SPI and I2C for 1-inch OLED display and RTC
- 1x USB 2.0 host port

Signed-off-by: Christian Hewitt 
---
 arch/arm64/boot/dts/amlogic/Makefile  |  1 +
 .../boot/dts/amlogic/meson-sm1-odroid-hc4.dts | 96 +++
 2 files changed, 97 insertions(+)
 create mode 100644 arch/arm64/boot/dts/amlogic/meson-sm1-odroid-hc4.dts

diff --git a/arch/arm64/boot/dts/amlogic/Makefile 
b/arch/arm64/boot/dts/amlogic/Makefile
index f3c8a85fe987..78a569d7fa20 100644
--- a/arch/arm64/boot/dts/amlogic/Makefile
+++ b/arch/arm64/boot/dts/amlogic/Makefile
@@ -47,5 +47,6 @@ dtb-$(CONFIG_ARCH_MESON) += meson-gxm-vega-s96.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxm-wetek-core2.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-sm1-khadas-vim3l.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-sm1-odroid-c4.dtb
+dtb-$(CONFIG_ARCH_MESON) += meson-sm1-odroid-hc4.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-sm1-sei610.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-a1-ad401.dtb
diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-hc4.dts 
b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-hc4.dts
new file mode 100644
index ..bf15700c4b15
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-hc4.dts
@@ -0,0 +1,96 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2020 Dongjin Kim 
+ */
+
+/dts-v1/;
+
+#include "meson-sm1-odroid.dtsi"
+
+/ {
+   compatible = "hardkernel,odroid-hc4", "amlogic,sm1";
+   model = "Hardkernel ODROID-HC4";
+
+   aliases {
+   rtc0 = 
+   rtc1 = 
+   };
+
+   fan0: pwm-fan {
+   compatible = "pwm-fan";
+   #cooling-cells = <2>;
+   cooling-min-state = <0>;
+   cooling-max-state = <3>;
+   cooling-levels = <0 120 170 220>;
+   pwms = <_cd 1 4 0>;
+   };
+
+   leds {
+   compatible = "gpio-leds";
+
+   led-blue {
+   color = ;
+   function = LED_FUNCTION_STATUS;
+   gpios = <_ao GPIOAO_11 GPIO_ACTIVE_HIGH>;
+   linux,default-trigger = "heartbeat";
+   panic-indicator;
+   };
+
+   led-red {
+   color = ;
+   function = LED_FUNCTION_POWER;
+   gpios = <_ao GPIOAO_7 GPIO_ACTIVE_HIGH>;
+   default-state = "on";
+   };
+   };
+
+   sound {
+   model = "ODROID-HC4";
+   };
+};
+
+_thermal {
+   cooling-maps {
+   map {
+   trip = <_passive>;
+   cooling-device = < THERMAL_NO_LIMIT 
THERMAL_NO_LIMIT>;
+   };
+   };
+};
+
+ {
+   linux,rc-map-name = "rc-odroid";
+};
+
+ {
+   status = "okay";
+   pinctrl-0 = <_sda_x_pins>, <_sck_x_pins>;
+   pinctrl-names = "default";
+
+   rtc: rtc@51 {
+   status = "okay";
+   compatible = "nxp,pcf8563";
+   reg = <0x51>;
+   wakeup-source;
+   };
+};
+
+ {
+   status = "okay";
+   reset-gpios = < GPIOH_4 GPIO_ACTIVE_LOW>;
+};
+
+_cd {
+   status = "okay";
+   pinctrl-names = "default";
+   pinctrl-0 = <_d_x6_pins>;
+};
+
+_emmc_c {
+   status = "disabled";
+};
+
+ {
+   phys = <_phy0>, <_phy1>;
+   phy-names = "usb2-phy0", "usb2-phy1";
+};
-- 
2.17.1



[PATCH 1/5] dt-bindings: arm: amlogic: sort SM1 bindings

2021-01-28 Thread Christian Hewitt
Sort the bindings before adding new SM1 devices.

Signed-off-by: Christian Hewitt 
---
 Documentation/devicetree/bindings/arm/amlogic.yaml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/arm/amlogic.yaml 
b/Documentation/devicetree/bindings/arm/amlogic.yaml
index 6bef60ddda64..b21ba8ba23dd 100644
--- a/Documentation/devicetree/bindings/arm/amlogic.yaml
+++ b/Documentation/devicetree/bindings/arm/amlogic.yaml
@@ -164,9 +164,9 @@ properties:
   - description: Boards with the Amlogic Meson SM1 S905X3/D3/Y3 SoC
 items:
   - enum:
-  - seirobotics,sei610
-  - khadas,vim3l
   - hardkernel,odroid-c4
+  - khadas,vim3l
+  - seirobotics,sei610
   - const: amlogic,sm1
 
   - description: Boards with the Amlogic Meson A1 A113L SoC
-- 
2.17.1



[PATCH 0/5] arm64: dts: meson: add support for ODROID-HC4

2021-01-28 Thread Christian Hewitt
This series fixes minor sort-order issues in the Amlogic bindings yaml and
dtb Makefile, then converts the existing ODROID-C2 dts into dtsi so we can
support its new sister product the ODROID-HC4.

I've also given the devices different audio card names. This is partly
cosmetic, but also because HC4 is HDMI-only while C4 can be used with
other i2c audio devices via an expansion connector so users may want to
use different alsa configs.

Patches to support the spifc chip are still being upstreamed [0] so this
will be addressed in a follow up. A WIP patch for the dts change can be
found in my amlogic-5.11.y dev branch [1].

For reference, here's dmesg from LibreELEC on 5.11-rc5 [2].

[0] 
https://patchwork.ozlabs.org/project/linux-mtd/patch/20201220224314.2659-1-andr...@rammhold.de/
[1] https://github.com/chewitt/linux/commits/amlogic-5.11.y
[2] http://ix.io/2NCi

Christian Hewitt (5):
  dt-bindings: arm: amlogic: sort SM1 bindings
  arm64: dts: meson: sort Amlogic dtb Makefile
  arm64: dts: meson: convert meson-sm1-odroid-c4 to dtsi
  dt-bindings: arm: amlogic: add ODROID-HC4 bindings
  arm64: dts: meson: add initial device-tree for ODROID-HC4

 .../devicetree/bindings/arm/amlogic.yaml  |   5 +-
 arch/arm64/boot/dts/amlogic/Makefile  |   3 +-
 .../boot/dts/amlogic/meson-sm1-odroid-c4.dts  | 427 +
 .../boot/dts/amlogic/meson-sm1-odroid-hc4.dts |  96 
 .../boot/dts/amlogic/meson-sm1-odroid.dtsi| 441 ++
 5 files changed, 543 insertions(+), 429 deletions(-)
 create mode 100644 arch/arm64/boot/dts/amlogic/meson-sm1-odroid-hc4.dts
 create mode 100644 arch/arm64/boot/dts/amlogic/meson-sm1-odroid.dtsi

-- 
2.17.1



[PATCH 4/5] dt-bindings: arm: amlogic: add ODROID-HC4 bindings

2021-01-28 Thread Christian Hewitt
Add the board bindings for the ODROID-HC4 device.

Signed-off-by: Christian Hewitt 
---
 Documentation/devicetree/bindings/arm/amlogic.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/arm/amlogic.yaml 
b/Documentation/devicetree/bindings/arm/amlogic.yaml
index b21ba8ba23dd..5f6769bf45bd 100644
--- a/Documentation/devicetree/bindings/arm/amlogic.yaml
+++ b/Documentation/devicetree/bindings/arm/amlogic.yaml
@@ -165,6 +165,7 @@ properties:
 items:
   - enum:
   - hardkernel,odroid-c4
+  - hardkernel,odroid-hc4
   - khadas,vim3l
   - seirobotics,sei610
   - const: amlogic,sm1
-- 
2.17.1



[PATCH v2] drm/lima: add governor data with pre-defined thresholds

2021-01-27 Thread Christian Hewitt
This patch adapts the panfrost pre-defined thresholds change [0] to the
lima driver to improve real-world performance. The upthreshold value has
been set to ramp GPU frequency to max freq faster (compared to panfrost)
to compensate for the lower overall performance of utgard devices.

[0] 
https://patchwork.kernel.org/project/dri-devel/patch/20210121170445.19761-1-lukasz.l...@arm.com/

Signed-off-by: Christian Hewitt 
---
Change since v1: increased upthreshold from 20 to 30, with a soft
dependency on Lukasz delayed timer patch [0]

[0] https://lore.kernel.org/lkml/20210127105121.20345-1-lukasz.l...@arm.com/

 drivers/gpu/drm/lima/lima_devfreq.c | 10 +-
 drivers/gpu/drm/lima/lima_devfreq.h |  2 ++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/lima/lima_devfreq.c 
b/drivers/gpu/drm/lima/lima_devfreq.c
index 5686ad4aaf7c..c9854315a0b5 100644
--- a/drivers/gpu/drm/lima/lima_devfreq.c
+++ b/drivers/gpu/drm/lima/lima_devfreq.c
@@ -163,8 +163,16 @@ int lima_devfreq_init(struct lima_device *ldev)
lima_devfreq_profile.initial_freq = cur_freq;
dev_pm_opp_put(opp);
 
+   /*
+* Setup default thresholds for the simple_ondemand governor.
+* The values are chosen based on experiments.
+*/
+   ldevfreq->gov_data.upthreshold = 30;
+   ldevfreq->gov_data.downdifferential = 5;
+
devfreq = devm_devfreq_add_device(dev, _devfreq_profile,
- DEVFREQ_GOV_SIMPLE_ONDEMAND, NULL);
+ DEVFREQ_GOV_SIMPLE_ONDEMAND,
+ >gov_data);
if (IS_ERR(devfreq)) {
dev_err(dev, "Couldn't initialize GPU devfreq\n");
ret = PTR_ERR(devfreq);
diff --git a/drivers/gpu/drm/lima/lima_devfreq.h 
b/drivers/gpu/drm/lima/lima_devfreq.h
index 2d9b3008ce77..b0c7c736e81a 100644
--- a/drivers/gpu/drm/lima/lima_devfreq.h
+++ b/drivers/gpu/drm/lima/lima_devfreq.h
@@ -4,6 +4,7 @@
 #ifndef __LIMA_DEVFREQ_H__
 #define __LIMA_DEVFREQ_H__
 
+#include 
 #include 
 #include 
 
@@ -18,6 +19,7 @@ struct lima_devfreq {
struct opp_table *clkname_opp_table;
struct opp_table *regulators_opp_table;
struct thermal_cooling_device *cooling;
+   struct devfreq_simple_ondemand_data gov_data;
 
ktime_t busy_time;
ktime_t idle_time;
-- 
2.17.1



Re: [PATCH] drm/lima: add governor data with pre-defined thresholds

2021-01-27 Thread Christian Hewitt


> On 27 Jan 2021, at 3:11 pm, Lukasz Luba  wrote:
> 
> On 1/27/21 10:24 AM, Lukasz Luba wrote:
>> Hi Christian,
>> On 1/25/21 8:18 AM, Christian Hewitt wrote:
>>> This patch adapts the panfrost pre-defined thresholds change [0] to the
>>> lima driver to improve real-world performance. The upthreshold value has
>>> been set to ramp GPU frequency to max freq faster (compared to panfrost)
>>> to compensate for the lower overall performance of utgard devices.
>>> 
>>> [0] 
>>> https://patchwork.kernel.org/project/dri-devel/patch/20210121170445.19761-1-lukasz.l...@arm.com/
>>>  
>>> 
>>> Signed-off-by: Christian Hewitt 
>>> ---
>>> I have been using Kodi as my test application. If you scroll in library
>>> views with hundreds of list items and the panfrost values the slow GPU
>>> ramp up is quite noticeable and the GUI feels sluggish. As everything
>>> lima runs on is inherently slower than panfrost using devices I believe
>>> it's better to ramp up to max freq quicker.
>> It's quite low value for the upthreshold, but I believe you have
>> experimented and observed that a bit higher (30, 40?) don't work well.
>> I don't know the Kodi system, though.
>> You can check if the other frequencies are also used in statistics for
>> devfreq device:
>> cat /sys/class/devfreq//trans_stats
>> If they are also used, then it OK (better than stuck at min freq).
> 
> I've just realized that your board might suffer a another issue.
> Please apply this patch [1] and run your experiments with upthresholds.
> 
> [1] https://lore.kernel.org/lkml/20210127105121.20345-1-lukasz.l...@arm.com/

I’ve included the patch and with unscientific testing it feels snappier with a 
larger value than
before. I did revert back to 45 first, but again this feels sluggish when 
navigating around the
Kodi GUI. My main test is to enter ‘Movies’ in Kodi then start scrolling in a 
long list. When
the GPU ramps up quickly the experience is snappy, but when it ramps more 
conservatively
scrolling feels like it stutters, then (once you hit max freq) it becomes fluid.

WP2:~ # cat /sys/class/devfreq/d00c.gpu/trans_stat 
 From  :   To
   : 12500 25000 285714285 4 5 6 
74400   time(ms)
* 12500: 0 0 0 0 0 0   
264 52720
  25000: 9 0 0 0 0 0
36  3404
  285714285: 9 3 0 0 0 0
32  2628
  4:182013 0 0 0   
191 21140
  5:1212 863 0 0
31 10068
  6:   179 516   13366 0
24 29360
  74400:37 5 74660   423
 0 46016

I’ll send v2 with the value set to 30.

Christian

[PATCH] drm/lima: add governor data with pre-defined thresholds

2021-01-25 Thread Christian Hewitt
This patch adapts the panfrost pre-defined thresholds change [0] to the
lima driver to improve real-world performance. The upthreshold value has
been set to ramp GPU frequency to max freq faster (compared to panfrost)
to compensate for the lower overall performance of utgard devices.

[0] 
https://patchwork.kernel.org/project/dri-devel/patch/20210121170445.19761-1-lukasz.l...@arm.com/

Signed-off-by: Christian Hewitt 
---
I have been using Kodi as my test application. If you scroll in library
views with hundreds of list items and the panfrost values the slow GPU
ramp up is quite noticeable and the GUI feels sluggish. As everything
lima runs on is inherently slower than panfrost using devices I believe
it's better to ramp up to max freq quicker.

 drivers/gpu/drm/lima/lima_devfreq.c | 10 +-
 drivers/gpu/drm/lima/lima_devfreq.h |  2 ++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/lima/lima_devfreq.c 
b/drivers/gpu/drm/lima/lima_devfreq.c
index 5686ad4aaf7c..c9854315a0b5 100644
--- a/drivers/gpu/drm/lima/lima_devfreq.c
+++ b/drivers/gpu/drm/lima/lima_devfreq.c
@@ -163,8 +163,16 @@ int lima_devfreq_init(struct lima_device *ldev)
lima_devfreq_profile.initial_freq = cur_freq;
dev_pm_opp_put(opp);
 
+   /*
+* Setup default thresholds for the simple_ondemand governor.
+* The values are chosen based on experiments.
+*/
+   ldevfreq->gov_data.upthreshold = 20;
+   ldevfreq->gov_data.downdifferential = 5;
+
devfreq = devm_devfreq_add_device(dev, _devfreq_profile,
- DEVFREQ_GOV_SIMPLE_ONDEMAND, NULL);
+ DEVFREQ_GOV_SIMPLE_ONDEMAND,
+ >gov_data);
if (IS_ERR(devfreq)) {
dev_err(dev, "Couldn't initialize GPU devfreq\n");
ret = PTR_ERR(devfreq);
diff --git a/drivers/gpu/drm/lima/lima_devfreq.h 
b/drivers/gpu/drm/lima/lima_devfreq.h
index 2d9b3008ce77..b0c7c736e81a 100644
--- a/drivers/gpu/drm/lima/lima_devfreq.h
+++ b/drivers/gpu/drm/lima/lima_devfreq.h
@@ -4,6 +4,7 @@
 #ifndef __LIMA_DEVFREQ_H__
 #define __LIMA_DEVFREQ_H__
 
+#include 
 #include 
 #include 
 
@@ -18,6 +19,7 @@ struct lima_devfreq {
struct opp_table *clkname_opp_table;
struct opp_table *regulators_opp_table;
struct thermal_cooling_device *cooling;
+   struct devfreq_simple_ondemand_data gov_data;
 
ktime_t busy_time;
ktime_t idle_time;
-- 
2.17.1



[PATCH v3 0/2] arm64: dts: meson: add support for Beelink GS-King-X

2021-01-19 Thread Christian Hewitt
This series adds bindings and device-tree for the Beelink (AZW) GS-King-X,
which like GT-King and GT-King Pro is based on the W400 reference design.

Changes since v2:
- shorten audio card name to GSKING-X
- add Neil's tested-by
- add Martin's reviews

Changes since v1:
- move audio from TDM_B to TDM_A
- drop S/PDIF content
- add Rob's bindings ack

Christian Hewitt (2):
  dt-bindings: arm: amlogic: add support for the Beelink GS-King-X
  arm64: dts: meson: add initial Beelink GS-King-X device-tree

 .../devicetree/bindings/arm/amlogic.yaml  |   1 +
 arch/arm64/boot/dts/amlogic/Makefile  |   1 +
 .../boot/dts/amlogic/meson-g12b-gsking-x.dts  | 133 ++
 3 files changed, 135 insertions(+)
 create mode 100644 arch/arm64/boot/dts/amlogic/meson-g12b-gsking-x.dts

-- 
2.17.1



[PATCH v3 2/2] arm64: dts: meson: add initial Beelink GS-King-X device-tree

2021-01-19 Thread Christian Hewitt
The Shenzen AZW (Beelink) GS-King-X is based on the Amlogic W400 reference
board with an S922X-H chip.

- 4GB LPDDR4 RAM
- 64GB eMMC storage
- 10/100/1000 Base-T Ethernet
- AP6356S Wireless (802.11 a/b/g/n/ac, BT 4.1)
- HDMI 2.1 video
- S/PDIF optical output
- 2x ESS9018 audio DACs
- 4x Ricor RT6862 audio amps
- Analogue headphone output
- 1x USB 2.0 OTG port
- 3x USB 3.0 ports
- IR receiver
- 1x micro SD card slot (internal)
- USB SATA controller with 2x 3.5" drive bays
- 1x Power on/off button

Signed-off-by: Christian Hewitt 
Acked-by: Martin Blumenstingl 
Tested-by: Neil Armstrong 
---
Single change since v2 to shorten the audio card name to align with the
audio card name changes submitted in [0] (no dependency on the patch).

[0] 
https://patchwork.kernel.org/project/linux-amlogic/patch/20210101063737.26635-1-christianshew...@gmail.com/

 arch/arm64/boot/dts/amlogic/Makefile  |   1 +
 .../boot/dts/amlogic/meson-g12b-gsking-x.dts  | 133 ++
 2 files changed, 134 insertions(+)
 create mode 100644 arch/arm64/boot/dts/amlogic/meson-g12b-gsking-x.dts

diff --git a/arch/arm64/boot/dts/amlogic/Makefile 
b/arch/arm64/boot/dts/amlogic/Makefile
index ced03946314f..dce41cd3f347 100644
--- a/arch/arm64/boot/dts/amlogic/Makefile
+++ b/arch/arm64/boot/dts/amlogic/Makefile
@@ -3,6 +3,7 @@ dtb-$(CONFIG_ARCH_MESON) += meson-axg-s400.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-g12a-sei510.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-g12a-u200.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-g12a-x96-max.dtb
+dtb-$(CONFIG_ARCH_MESON) += meson-g12b-gsking-x.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-g12b-gtking.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-g12b-gtking-pro.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-g12b-a311d-khadas-vim3.dtb
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-gsking-x.dts 
b/arch/arm64/boot/dts/amlogic/meson-g12b-gsking-x.dts
new file mode 100644
index ..211191f66344
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-gsking-x.dts
@@ -0,0 +1,133 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2019 BayLibre, SAS
+ * Author: Neil Armstrong 
+ * Copyright (c) 2019 Christian Hewitt 
+ */
+
+/dts-v1/;
+
+#include "meson-g12b-w400.dtsi"
+#include 
+#include 
+
+/ {
+   compatible = "azw,gsking-x", "amlogic,g12b";
+   model = "Beelink GS-King X";
+
+   aliases {
+   rtc0 = 
+   rtc1 = 
+   };
+
+   gpio-keys-polled {
+   compatible = "gpio-keys-polled";
+   #address-cells = <1>;
+   #size-cells = <0>;
+   poll-interval = <100>;
+
+   power-button {
+   label = "power";
+   linux,code = ;
+   gpios = <_ao GPIOAO_3 GPIO_ACTIVE_HIGH>;
+   };
+   };
+
+   sound {
+   compatible = "amlogic,axg-sound-card";
+   model = "GSKING-X";
+   audio-aux-devs = <_a>;
+   audio-routing = "TDMOUT_A IN 0", "FRDDR_A OUT 1",
+   "TDMOUT_A IN 1", "FRDDR_B OUT 1",
+   "TDMOUT_A IN 2", "FRDDR_C OUT 1",
+   "TDM_A Playback", "TDMOUT_A OUT";
+
+   assigned-clocks = < CLKID_MPLL2>,
+ < CLKID_MPLL0>,
+ < CLKID_MPLL1>;
+   assigned-clock-parents = <0>, <0>, <0>;
+   assigned-clock-rates = <294912000>,
+  <270950400>,
+  <393216000>;
+   status = "okay";
+
+   dai-link-0 {
+   sound-dai = <_a>;
+   };
+
+   dai-link-1 {
+   sound-dai = <_b>;
+   };
+
+   dai-link-2 {
+   sound-dai = <_c>;
+   };
+
+   /* 8ch hdmi interface */
+   dai-link-3 {
+   sound-dai = <_a>;
+   dai-format = "i2s";
+   dai-tdm-slot-tx-mask-0 = <1 1>;
+   dai-tdm-slot-tx-mask-1 = <1 1>;
+   dai-tdm-slot-tx-mask-2 = <1 1>;
+   dai-tdm-slot-tx-mask-3 = <1 1>;
+   mclk-fs = <256>;
+
+   codec {
+   sound-dai = < TOHDMITX_I2S_IN_A>;
+   };
+   };
+
+   dai-link-4 {
+   sound-dai = < TOHDMITX_I2S_OUT>;
+
+   codec {
+   sound-dai = <_tx>;
+

[PATCH v3 1/2] dt-bindings: arm: amlogic: add support for the Beelink GS-King-X

2021-01-19 Thread Christian Hewitt
The Shenzen AZW (Beelink) GS-King-X is based on the Amlogic W400 reference
board with an S922X-H chip.

Signed-off-by: Christian Hewitt 
Acked-by: Rob Herring 
Reviewed-by: Martin Blumenstingl 
---
 Documentation/devicetree/bindings/arm/amlogic.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/arm/amlogic.yaml 
b/Documentation/devicetree/bindings/arm/amlogic.yaml
index 3341788d1096..6bef60ddda64 100644
--- a/Documentation/devicetree/bindings/arm/amlogic.yaml
+++ b/Documentation/devicetree/bindings/arm/amlogic.yaml
@@ -151,6 +151,7 @@ properties:
   - description: Boards with the Amlogic Meson G12B S922X SoC
 items:
   - enum:
+  - azw,gsking-x
   - azw,gtking
   - azw,gtking-pro
   - hardkernel,odroid-n2
-- 
2.17.1



[PATCH] arm64: dts: meson: add i2c3/rtc nodes and rtc aliases to ODROID-N2 dtsi

2021-01-11 Thread Christian Hewitt
Enable the onboard pcf8563 rtc hardware on ODROID N2/N2+ boards via the
common dtsi. Also add aliases to ensure vrtc does not claim /dev/rtc0.

Signed-off-by: Christian Hewitt 
---
 .../boot/dts/amlogic/meson-g12b-odroid-n2.dtsi | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi 
b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi
index 39a09661c5f6..b78be3e6974d 100644
--- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi
@@ -13,6 +13,8 @@
aliases {
serial0 = _AO;
ethernet0 = 
+   rtc0 = 
+   rtc1 = 
};
 
dioo2133: audio-amplifier-0 {
@@ -478,6 +480,18 @@
linux,rc-map-name = "rc-odroid";
 };
 
+ {
+   status = "okay";
+   pinctrl-0 = <_sda_a_pins>, <_sck_a_pins>;
+   pinctrl-names = "default";
+
+   rtc: rtc@51 {
+   compatible = "nxp,pcf8563";
+   reg = <0x51>;
+   wakeup-source;
+   };
+};
+
 _ab {
pinctrl-0 = <_a_e_pins>;
pinctrl-names = "default";
-- 
2.17.1



[PATCH] arm64: dts: meson: shorten audio card names for alsa compatibility

2020-12-31 Thread Christian Hewitt
This patch shortens all audio card model names by dropping the SoC prefix
(for conformity) and rewording those that are still longer than alsa's 15
character name limit [0] to avoid userspace config issues.

[0] 
https://github.com/torvalds/linux/blob/master/Documentation/sound/alsa-configuration.rst#common-parameters-for-top-sound-card-modules

Signed-off-by: Christian Hewitt 
---
I've been experimenting with alsa conf files to ensure alsa handles
multi-channel audio properly (else channels are messed up) and it's
been bugging me why an Odroid N2 showed surroundXX devices (defined in
a common alsa conf) while a VIM3 only showed sysdefault devices. The
eureka moment is discovering alsa enforces a 15-character limit on
model names, so G12B-ODROID-N2 (14) works while longer names like
G12B-KHADAS-VIM3 (16) truncate to e.g. G12B-KHADAS-VIM causing mismatch
with the strings alsa-lib matches conf(s) against.

VIM3:~ # cat /proc/asound/cards
 0 [G12BKHADASVIM3 ]: G12B-KHADAS-VIM - G12B-KHADAS-VIM3
  G12B-KHADAS-VIM3

I'm using aliases.conf with alsa-lib to map 20+ card names back to
two confs so I _could_ just map the truncated names, but this is not
obvious for users and other maintainers so the better solution is
shortening the names.

 arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts   | 2 +-
 arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts  | 2 +-
 arch/arm64/boot/dts/amlogic/meson-g12b-gtking-pro.dts   | 2 +-
 arch/arm64/boot/dts/amlogic/meson-g12b-gtking.dts   | 2 +-
 arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi   | 2 +-
 arch/arm64/boot/dts/amlogic/meson-g12b-ugoos-am6.dts| 2 +-
 arch/arm64/boot/dts/amlogic/meson-gx-libretech-pc.dtsi  | 2 +-
 arch/arm64/boot/dts/amlogic/meson-gx-p23x-q20x.dtsi | 2 +-
 arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts| 2 +-
 arch/arm64/boot/dts/amlogic/meson-gxbb-nexbox-a95x.dts  | 2 +-
 arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts | 2 +-
 arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-hub.dts| 2 +-
 arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-play2.dts  | 2 +-
 arch/arm64/boot/dts/amlogic/meson-gxl-s805x-libretech-ac.dts| 2 +-
 arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts  | 2 +-
 arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc-v2.dts | 2 +-
 arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts| 2 +-
 arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts   | 2 +-
 arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi  | 2 +-
 arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts | 2 +-
 arch/arm64/boot/dts/amlogic/meson-sm1-sei610.dts| 2 +-
 21 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts 
b/arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts
index b00d0468c753..81269ccc2496 100644
--- a/arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts
@@ -181,7 +181,7 @@
 
sound {
compatible = "amlogic,axg-sound-card";
-   model = "G12A-SEI510";
+   model = "SEI510";
audio-aux-devs = <_a>, <_b>,
 <_a>, <_b>;
audio-routing = "TDMOUT_A IN 0", "FRDDR_A OUT 0",
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts 
b/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts
index 463a72d6bb7c..579f3d02d613 100644
--- a/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts
@@ -150,7 +150,7 @@
 
sound {
compatible = "amlogic,axg-sound-card";
-   model = "G12A-X96-MAX";
+   model = "X96-MAX";
audio-aux-devs = <_b>;
audio-routing = "TDMOUT_B IN 0", "FRDDR_A OUT 1",
"TDMOUT_B IN 1", "FRDDR_B OUT 1",
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-gtking-pro.dts 
b/arch/arm64/boot/dts/amlogic/meson-g12b-gtking-pro.dts
index 0e5c500fb78f..0e331aa5a2d7 100644
--- a/arch/arm64/boot/dts/amlogic/meson-g12b-gtking-pro.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-gtking-pro.dts
@@ -44,7 +44,7 @@
 
sound {
compatible = "amlogic,axg-sound-card";
-   model = "G12B-GTKING-PRO";
+   model = "GTKING-PRO";
audio-aux-devs = <_b>;
audio-routing = "TDMOUT_B IN 0", "FRDDR_A OUT 1",
"TDMOUT_B IN 1", "FRDDR_B OUT 1",
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-gtking.dts 
b/arch/arm64/boot/dts/amlogic/meson-g12b

Re: [PATCH v2 2/2] arm64: dts: meson: add initial Beelink GS-King-X device-tree

2020-12-30 Thread Christian Hewitt


> On 31 Dec 2020, at 4:23 am, Martin Blumenstingl 
>  wrote:
> 
> On Wed, Dec 30, 2020 at 11:38 AM Christian Hewitt
>  wrote:
>> 
>> The Shenzen AZW (Beelink) GS-King-X is based on the Amlogic W400 reference
>> board with an S922X-H chip.
>> 
>> - 4GB LPDDR4 RAM
>> - 64GB eMMC storage
>> - 10/100/1000 Base-T Ethernet
>> - AP6356S Wireless (802.11 a/b/g/n/ac, BT 4.1)
>> - HDMI 2.1 video
>> - S/PDIF optical output
> are you planning to enable this also?

I plan to add this later (after v1 comments).

>> - 2x ESS9018 audio DACs
>> - 4x Ricor RT6862 audio amps
>> - Analogue headphone output
> there's no driver for that DAC so I think that's why you are not enabling them

ESS9018 is used with some Raspberry Pi DAC boards so there may be some prior
art to build upon. However it’s not clear (even with schematics) how the DAC
and AMP are controlled (they look like dumb input/output devices) so this is
still to be explored.

>> - 1x USB 2.0 OTG port
>> - 3x USB 3.0 ports
>> - IR receiver
>> - 1x micro SD card slot (internal)
>> - USB SATA controller with 2x 3.5" drive bays
>> - 1x Power on/off button
>> 
>> Signed-off-by: Christian Hewitt 
> I don't know/have this board but also I don't see anything problematic so:
> Acked-by: Martin Blumenstingl 

Thx!

[PATCH v2 2/2] arm64: dts: meson: add initial Beelink GS-King-X device-tree

2020-12-30 Thread Christian Hewitt
The Shenzen AZW (Beelink) GS-King-X is based on the Amlogic W400 reference
board with an S922X-H chip.

- 4GB LPDDR4 RAM
- 64GB eMMC storage
- 10/100/1000 Base-T Ethernet
- AP6356S Wireless (802.11 a/b/g/n/ac, BT 4.1)
- HDMI 2.1 video
- S/PDIF optical output
- 2x ESS9018 audio DACs
- 4x Ricor RT6862 audio amps
- Analogue headphone output
- 1x USB 2.0 OTG port
- 3x USB 3.0 ports
- IR receiver
- 1x micro SD card slot (internal)
- USB SATA controller with 2x 3.5" drive bays
- 1x Power on/off button

Signed-off-by: Christian Hewitt 
---
 arch/arm64/boot/dts/amlogic/Makefile  |   1 +
 .../boot/dts/amlogic/meson-g12b-gsking-x.dts  | 133 ++
 2 files changed, 134 insertions(+)
 create mode 100644 arch/arm64/boot/dts/amlogic/meson-g12b-gsking-x.dts

diff --git a/arch/arm64/boot/dts/amlogic/Makefile 
b/arch/arm64/boot/dts/amlogic/Makefile
index ced03946314f..dce41cd3f347 100644
--- a/arch/arm64/boot/dts/amlogic/Makefile
+++ b/arch/arm64/boot/dts/amlogic/Makefile
@@ -3,6 +3,7 @@ dtb-$(CONFIG_ARCH_MESON) += meson-axg-s400.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-g12a-sei510.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-g12a-u200.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-g12a-x96-max.dtb
+dtb-$(CONFIG_ARCH_MESON) += meson-g12b-gsking-x.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-g12b-gtking.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-g12b-gtking-pro.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-g12b-a311d-khadas-vim3.dtb
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-gsking-x.dts 
b/arch/arm64/boot/dts/amlogic/meson-g12b-gsking-x.dts
new file mode 100644
index ..c9d9dcb0cd65
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-gsking-x.dts
@@ -0,0 +1,133 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2019 BayLibre, SAS
+ * Author: Neil Armstrong 
+ * Copyright (c) 2019 Christian Hewitt 
+ */
+
+/dts-v1/;
+
+#include "meson-g12b-w400.dtsi"
+#include 
+#include 
+
+/ {
+   compatible = "azw,gsking-x", "amlogic,g12b";
+   model = "Beelink GS-King X";
+
+   aliases {
+   rtc0 = 
+   rtc1 = 
+   };
+
+   gpio-keys-polled {
+   compatible = "gpio-keys-polled";
+   #address-cells = <1>;
+   #size-cells = <0>;
+   poll-interval = <100>;
+
+   power-button {
+   label = "power";
+   linux,code = ;
+   gpios = <_ao GPIOAO_3 GPIO_ACTIVE_HIGH>;
+   };
+   };
+
+   sound {
+   compatible = "amlogic,axg-sound-card";
+   model = "G12B-GSKING-X";
+   audio-aux-devs = <_a>;
+   audio-routing = "TDMOUT_A IN 0", "FRDDR_A OUT 1",
+   "TDMOUT_A IN 1", "FRDDR_B OUT 1",
+   "TDMOUT_A IN 2", "FRDDR_C OUT 1",
+   "TDM_A Playback", "TDMOUT_A OUT";
+
+   assigned-clocks = < CLKID_MPLL2>,
+ < CLKID_MPLL0>,
+ < CLKID_MPLL1>;
+   assigned-clock-parents = <0>, <0>, <0>;
+   assigned-clock-rates = <294912000>,
+  <270950400>,
+  <393216000>;
+   status = "okay";
+
+   dai-link-0 {
+   sound-dai = <_a>;
+   };
+
+   dai-link-1 {
+   sound-dai = <_b>;
+   };
+
+   dai-link-2 {
+   sound-dai = <_c>;
+   };
+
+   /* 8ch hdmi interface */
+   dai-link-3 {
+   sound-dai = <_a>;
+   dai-format = "i2s";
+   dai-tdm-slot-tx-mask-0 = <1 1>;
+   dai-tdm-slot-tx-mask-1 = <1 1>;
+   dai-tdm-slot-tx-mask-2 = <1 1>;
+   dai-tdm-slot-tx-mask-3 = <1 1>;
+   mclk-fs = <256>;
+
+   codec {
+   sound-dai = < TOHDMITX_I2S_IN_A>;
+   };
+   };
+
+   dai-link-4 {
+   sound-dai = < TOHDMITX_I2S_OUT>;
+
+   codec {
+   sound-dai = <_tx>;
+   };
+   };
+   };
+};
+
+ {
+   status = "okay";
+};
+
+_audio {
+   status = "okay";
+};
+
+_a {
+   status = "okay";
+};
+
+_b {
+   status = "okay";
+};
+
+_c {
+   status = "okay";
+};
+
+ {
+   status = "okay";
+   pinctrl-0 = <_sda_a_pins>, <_sck_a_pins>;
+   pinctrl-names = "default";
+
+   rtc: rtc@51 {
+   compatible = "nxp,pcf8563";
+   reg = <0x51>;
+   wakeup-source;
+   };
+};
+
+_a {
+   status = "okay";
+};
+
+_a {
+   status = "okay";
+};
+
+ {
+   status = "okay";
+};
-- 
2.17.1



[PATCH v2 1/2] dt-bindings: arm: amlogic: add support for the Beelink GS-King-X

2020-12-30 Thread Christian Hewitt
The Shenzen AZW (Beelink) GS-King-X is based on the Amlogic W400 reference
board with an S922X-H chip.

Signed-off-by: Christian Hewitt 
Acked-by: Rob Herring 
---
 Documentation/devicetree/bindings/arm/amlogic.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/arm/amlogic.yaml 
b/Documentation/devicetree/bindings/arm/amlogic.yaml
index 3341788d1096..6bef60ddda64 100644
--- a/Documentation/devicetree/bindings/arm/amlogic.yaml
+++ b/Documentation/devicetree/bindings/arm/amlogic.yaml
@@ -151,6 +151,7 @@ properties:
   - description: Boards with the Amlogic Meson G12B S922X SoC
 items:
   - enum:
+  - azw,gsking-x
   - azw,gtking
   - azw,gtking-pro
   - hardkernel,odroid-n2
-- 
2.17.1



[PATCH v2 0/2] arm64: dts: meson: add support for Beelink GS-King-X

2020-12-30 Thread Christian Hewitt
This series adds bindings and device-tree for the Beelink (AZW) GS-King-X,
which like GT-King and GT-King Pro is based on the W400 reference design.

Changes since v1:
- move audio from TDM_B to TDM_A
- drop S/PDIF content
- add Rob's bindings ack

Christian Hewitt (2):
  dt-bindings: arm: amlogic: add support for the Beelink GS-King-X
  arm64: dts: meson: add initial Beelink GS-King-X device-tree

 .../devicetree/bindings/arm/amlogic.yaml  |   1 +
 arch/arm64/boot/dts/amlogic/Makefile  |   1 +
 .../boot/dts/amlogic/meson-g12b-gsking-x.dts  | 133 ++
 3 files changed, 135 insertions(+)
 create mode 100644 arch/arm64/boot/dts/amlogic/meson-g12b-gsking-x.dts

-- 
2.17.1



[PATCH] arm64: dts: meson: minor fixups for Khadas VIM/VIM2 dts

2020-12-02 Thread Christian Hewitt
Reorder the VIM/VIM2 includes/bindings to follow the format of other dts
in the Amlogic tree and remove a stray empty line in the VIM2 dts.

Signed-off-by: Christian Hewitt 
---
This patch depends on the v4 "arm64: dts: meson: add more GX soundcards" series 
[0]
being merged first.

[0] http://lists.infradead.org/pipermail/linux-amlogic/2020-December/009236.html

 arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts | 3 +--
 arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts  | 4 +---
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts 
b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts
index 7aa08f74c49b..6fe589cd2ba2 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts
@@ -5,9 +5,8 @@
 
 /dts-v1/;
 
-#include 
-
 #include "meson-gxl-s905x-p212.dtsi"
+#include 
 #include 
 
 / {
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts 
b/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts
index 0250c98dbe9e..955a63aaa5ed 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts
@@ -7,9 +7,8 @@
 
 /dts-v1/;
 
-#include 
-
 #include "meson-gxm.dtsi"
+#include 
 #include 
 
 / {
@@ -194,7 +193,6 @@
hdmi-phandle = <_tx>;
 };
 
-
 _cooling_maps {
map0 {
cooling-device = <_fan THERMAL_NO_LIMIT 1>;
-- 
2.17.1


[PATCH v4 5/7] arm64: dts: meson: add audio playback to odroid-c2

2020-12-02 Thread Christian Hewitt
Add initial audio support limited to HDMI i2s.

Signed-off-by: Christian Hewitt 
Acked-by: Jerome Brunet 
---
 .../boot/dts/amlogic/meson-gxbb-odroidc2.dts  | 40 +++
 1 file changed, 40 insertions(+)

diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts 
b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts
index 70fcfb7b0683..9d8c919c6e19 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts
@@ -9,6 +9,7 @@
 
 #include "meson-gxbb.dtsi"
 #include 
+#include 
 
 / {
compatible = "hardkernel,odroid-c2", "amlogic,meson-gxbb";
@@ -172,6 +173,45 @@
};
};
};
+
+   sound {
+   compatible = "amlogic,gx-sound-card";
+   model = "GXBB-ODROID-C2";
+   assigned-clocks = < CLKID_MPLL0>,
+ < CLKID_MPLL1>,
+ < CLKID_MPLL2>;
+   assigned-clock-parents = <0>, <0>, <0>;
+   assigned-clock-rates = <294912000>,
+  <270950400>,
+  <393216000>;
+   status = "okay";
+
+   dai-link-0 {
+   sound-dai = < AIU_CPU CPU_I2S_FIFO>;
+   };
+
+   dai-link-1 {
+   sound-dai = < AIU_CPU CPU_I2S_ENCODER>;
+   dai-format = "i2s";
+   mclk-fs = <256>;
+
+   codec-0 {
+   sound-dai = < AIU_HDMI CTRL_I2S>;
+   };
+   };
+
+   dai-link-2 {
+   sound-dai = < AIU_HDMI CTRL_OUT>;
+
+   codec-0 {
+   sound-dai = <_tx>;
+   };
+   };
+   };
+};
+
+ {
+   status = "okay";
 };
 
 _AO {
-- 
2.17.1



[PATCH v4 7/7] arm64: dts: meson: add audio playback to wetek-play2

2020-12-02 Thread Christian Hewitt
Add initial support limited to HDMI i2s and SPDIF (LPCM).

Signed-off-by: Christian Hewitt 
Acked-by: Jerome Brunet 
---
 .../dts/amlogic/meson-gxbb-wetek-play2.dts| 61 +++
 1 file changed, 61 insertions(+)

diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-play2.dts 
b/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-play2.dts
index 2ab8a3d10079..f2562c7de67c 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-play2.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-play2.dts
@@ -8,11 +8,19 @@
 
 #include "meson-gxbb-wetek.dtsi"
 #include 
+#include 
 
 / {
compatible = "wetek,play2", "amlogic,meson-gxbb";
model = "WeTek Play 2";
 
+   spdif_dit: audio-codec-0 {
+   #sound-dai-cells = <0>;
+   compatible = "linux,spdif-dit";
+   status = "okay";
+   sound-name-prefix = "DIT";
+   };
+
leds {
led-wifi {
label = "wetek-play:wifi-status";
@@ -39,6 +47,59 @@
gpios = <_ao GPIOAO_3 GPIO_ACTIVE_LOW>;
};
};
+
+   sound {
+   compatible = "amlogic,gx-sound-card";
+   model = "GXBB-WETEK-PLAY2";
+   assigned-clocks = < CLKID_MPLL0>,
+ < CLKID_MPLL1>,
+ < CLKID_MPLL2>;
+   assigned-clock-parents = <0>, <0>, <0>;
+   assigned-clock-rates = <294912000>,
+  <270950400>,
+  <393216000>;
+   status = "okay";
+
+   dai-link-0 {
+   sound-dai = < AIU_CPU CPU_I2S_FIFO>;
+   };
+
+   dai-link-1 {
+   sound-dai = < AIU_CPU CPU_SPDIF_FIFO>;
+   };
+
+   dai-link-2 {
+   sound-dai = < AIU_CPU CPU_I2S_ENCODER>;
+   dai-format = "i2s";
+   mclk-fs = <256>;
+
+   codec-0 {
+   sound-dai = < AIU_HDMI CTRL_I2S>;
+   };
+   };
+
+   dai-link-3 {
+   sound-dai = < AIU_CPU CPU_SPDIF_ENCODER>;
+
+   codec-0 {
+   sound-dai = <_dit>;
+   };
+   };
+
+   dai-link-4 {
+   sound-dai = < AIU_HDMI CTRL_OUT>;
+
+   codec-0 {
+   sound-dai = <_tx>;
+   };
+   };
+   };
+};
+
+ {
+   status = "okay";
+   pinctrl-0 = <_out_y_pins>;
+   pinctrl-names = "default";
 };
 
 _A {
-- 
2.17.1



[PATCH v4 0/7] arm64: dts: meson: add more GX soundcards

2020-12-02 Thread Christian Hewitt
This series adds basic support for LPCM audio over HDMI and S/PDIF
to GXBB/GXL/GXM devices that I own and have tested with. Audio can
be extended in the future (some devices have DACs and headphone
hardware to connect) but this gets the basics working.

Changes from v3
- Drop includes tidying in patches 2,3
- Add Jerome's acks

Changes from v2
- Drop p200/p201/p212-s905x/vega-s95 changes
- Add khadas-vim(1)

Changes from v1
- Drop nexbox-a1 and rbox-pro 

Christian Hewitt (7):
  arm64: dts: meson: add audio playback to a95x
  arm64: dts: meson: add audio playback to khadas-vim
  arm64: dts: meson: add audio playback to khadas-vim2
  arm64: dts: meson: add audio playback to nanopi-k2
  arm64: dts: meson: add audio playback to odroid-c2
  arm64: dts: meson: add audio playback to wetek-hub
  arm64: dts: meson: add audio playback to wetek-play2

 .../boot/dts/amlogic/meson-gxbb-nanopi-k2.dts | 40 
 .../dts/amlogic/meson-gxbb-nexbox-a95x.dts| 40 
 .../boot/dts/amlogic/meson-gxbb-odroidc2.dts  | 40 
 .../boot/dts/amlogic/meson-gxbb-wetek-hub.dts | 40 
 .../dts/amlogic/meson-gxbb-wetek-play2.dts| 61 +++
 .../amlogic/meson-gxl-s905x-khadas-vim.dts| 43 -
 .../dts/amlogic/meson-gxm-khadas-vim2.dts | 44 -
 7 files changed, 303 insertions(+), 5 deletions(-)

-- 
2.17.1



[PATCH v4 6/7] arm64: dts: meson: add audio playback to wetek-hub

2020-12-02 Thread Christian Hewitt
Add initial audio support limited to HDMI i2s.

Signed-off-by: Christian Hewitt 
Acked-by: Jerome Brunet 
---
 .../boot/dts/amlogic/meson-gxbb-wetek-hub.dts | 40 +++
 1 file changed, 40 insertions(+)

diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-hub.dts 
b/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-hub.dts
index 83b985bb015e..0c1570153842 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-hub.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-hub.dts
@@ -7,10 +7,50 @@
 /dts-v1/;
 
 #include "meson-gxbb-wetek.dtsi"
+#include 
 
 / {
compatible = "wetek,hub", "amlogic,meson-gxbb";
model = "WeTek Hub";
+
+   sound {
+   compatible = "amlogic,gx-sound-card";
+   model = "GXBB-WETEK-HUB";
+   assigned-clocks = < CLKID_MPLL0>,
+ < CLKID_MPLL1>,
+ < CLKID_MPLL2>;
+   assigned-clock-parents = <0>, <0>, <0>;
+   assigned-clock-rates = <294912000>,
+  <270950400>,
+  <393216000>;
+   status = "okay";
+
+   dai-link-0 {
+   sound-dai = < AIU_CPU CPU_I2S_FIFO>;
+   };
+
+   dai-link-1 {
+   sound-dai = < AIU_CPU CPU_I2S_ENCODER>;
+   dai-format = "i2s";
+   mclk-fs = <256>;
+
+   codec-0 {
+   sound-dai = < AIU_HDMI CTRL_I2S>;
+   };
+   };
+
+   dai-link-2 {
+   sound-dai = < AIU_HDMI CTRL_OUT>;
+
+   codec-0 {
+   sound-dai = <_tx>;
+   };
+   };
+   };
+};
+
+ {
+   status = "okay";
 };
 
  {
-- 
2.17.1



[PATCH v4 4/7] arm64: dts: meson: add audio playback to nanopi-k2

2020-12-02 Thread Christian Hewitt
Add initial audio support limited to HDMI i2s.

Signed-off-by: Christian Hewitt 
Acked-by: Jerome Brunet 
---
 .../boot/dts/amlogic/meson-gxbb-nanopi-k2.dts | 40 +++
 1 file changed, 40 insertions(+)

diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts 
b/arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts
index 7be3e354093b..8e5df00b06a2 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts
@@ -7,6 +7,7 @@
 
 #include "meson-gxbb.dtsi"
 #include 
+#include 
 
 / {
compatible = "friendlyarm,nanopi-k2", "amlogic,meson-gxbb";
@@ -130,6 +131,45 @@
};
};
};
+
+   sound {
+   compatible = "amlogic,gx-sound-card";
+   model = "GXBB-NANOPI-K2";
+   assigned-clocks = < CLKID_MPLL0>,
+ < CLKID_MPLL1>,
+ < CLKID_MPLL2>;
+   assigned-clock-parents = <0>, <0>, <0>;
+   assigned-clock-rates = <294912000>,
+  <270950400>,
+  <393216000>;
+   status = "okay";
+
+   dai-link-0 {
+   sound-dai = < AIU_CPU CPU_I2S_FIFO>;
+   };
+
+   dai-link-1 {
+   sound-dai = < AIU_CPU CPU_I2S_ENCODER>;
+   dai-format = "i2s";
+   mclk-fs = <256>;
+
+   codec-0 {
+   sound-dai = < AIU_HDMI CTRL_I2S>;
+   };
+   };
+
+   dai-link-2 {
+   sound-dai = < AIU_HDMI CTRL_OUT>;
+
+   codec-0 {
+   sound-dai = <_tx>;
+   };
+   };
+   };
+};
+
+ {
+   status = "okay";
 };
 
 _AO {
-- 
2.17.1



[PATCH v4 2/7] arm64: dts: meson: add audio playback to khadas-vim

2020-12-02 Thread Christian Hewitt
Add initial audio support limited to HDMI i2s.

Signed-off-by: Christian Hewitt 
Acked-by: Jerome Brunet 
---
 .../amlogic/meson-gxl-s905x-khadas-vim.dts| 40 +++
 1 file changed, 40 insertions(+)

diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts 
b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts
index 638a5992d760..7aa08f74c49b 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts
@@ -8,6 +8,7 @@
 #include 
 
 #include "meson-gxl-s905x-p212.dtsi"
+#include 
 
 / {
compatible = "khadas,vim", "amlogic,s905x", "amlogic,meson-gxl";
@@ -63,6 +64,45 @@
};
};
};
+
+   sound {
+   compatible = "amlogic,gx-sound-card";
+   model = "GXL-KHADAS-VIM1";
+   assigned-clocks = < CLKID_MPLL0>,
+ < CLKID_MPLL1>,
+ < CLKID_MPLL2>;
+   assigned-clock-parents = <0>, <0>, <0>;
+   assigned-clock-rates = <294912000>,
+  <270950400>,
+  <393216000>;
+   status = "okay";
+
+   dai-link-0 {
+   sound-dai = < AIU_CPU CPU_I2S_FIFO>;
+   };
+
+   dai-link-1 {
+   sound-dai = < AIU_CPU CPU_I2S_ENCODER>;
+   dai-format = "i2s";
+   mclk-fs = <256>;
+
+   codec-0 {
+   sound-dai = < AIU_HDMI CTRL_I2S>;
+   };
+   };
+
+   dai-link-2 {
+   sound-dai = < AIU_HDMI CTRL_OUT>;
+
+   codec-0 {
+   sound-dai = <_tx>;
+   };
+   };
+   };
+};
+
+ {
+   status = "okay";
 };
 
 _AO {
-- 
2.17.1



[PATCH v4 1/7] arm64: dts: meson: add audio playback to a95x

2020-12-02 Thread Christian Hewitt
Add initial audio support limited to HDMI i2s.

Signed-off-by: Christian Hewitt 
Acked-by: Jerome Brunet 
---
 .../dts/amlogic/meson-gxbb-nexbox-a95x.dts| 40 +++
 1 file changed, 40 insertions(+)

diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-nexbox-a95x.dts 
b/arch/arm64/boot/dts/amlogic/meson-gxbb-nexbox-a95x.dts
index 67d901ed2fa3..b5b11cb9f393 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-nexbox-a95x.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-nexbox-a95x.dts
@@ -10,6 +10,7 @@
 #include "meson-gxbb.dtsi"
 #include 
 #include 
+#include 
 
 / {
compatible = "nexbox,a95x", "amlogic,meson-gxbb";
@@ -139,6 +140,45 @@
};
};
};
+
+   sound {
+   compatible = "amlogic,gx-sound-card";
+   model = "GXBB-NEXBOX-A95X";
+   assigned-clocks = < CLKID_MPLL0>,
+ < CLKID_MPLL1>,
+ < CLKID_MPLL2>;
+   assigned-clock-parents = <0>, <0>, <0>;
+   assigned-clock-rates = <294912000>,
+  <270950400>,
+  <393216000>;
+   status = "okay";
+
+   dai-link-0 {
+   sound-dai = < AIU_CPU CPU_I2S_FIFO>;
+   };
+
+   dai-link-1 {
+   sound-dai = < AIU_CPU CPU_I2S_ENCODER>;
+   dai-format = "i2s";
+   mclk-fs = <256>;
+
+   codec-0 {
+   sound-dai = < AIU_HDMI CTRL_I2S>;
+   };
+   };
+
+   dai-link-2 {
+   sound-dai = < AIU_HDMI CTRL_OUT>;
+
+   codec-0 {
+   sound-dai = <_tx>;
+   };
+   };
+   };
+};
+
+ {
+   status = "okay";
 };
 
 _vdac_port {
-- 
2.17.1



[PATCH v4 3/7] arm64: dts: meson: add audio playback to khadas-vim2

2020-12-02 Thread Christian Hewitt
Add initial audio support limited to HDMI i2s.

Signed-off-by: Christian Hewitt 
Acked-by: Jerome Brunet 
---
 .../dts/amlogic/meson-gxm-khadas-vim2.dts | 40 +++
 1 file changed, 40 insertions(+)

diff --git a/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts 
b/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts
index c5ee55caae0a..0250c98dbe9e 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts
@@ -10,6 +10,7 @@
 #include 
 
 #include "meson-gxm.dtsi"
+#include 
 
 / {
compatible = "khadas,vim2", "amlogic,s912", "amlogic,meson-gxm";
@@ -145,6 +146,45 @@
clock-frequency = <32768>;
pwms = <_ef 0 30518 0>; /* PWM_E at 32.768KHz */
};
+
+   sound {
+   compatible = "amlogic,gx-sound-card";
+   model = "GXM-KHADAS-VIM2";
+   assigned-clocks = < CLKID_MPLL0>,
+ < CLKID_MPLL1>,
+ < CLKID_MPLL2>;
+   assigned-clock-parents = <0>, <0>, <0>;
+   assigned-clock-rates = <294912000>,
+  <270950400>,
+  <393216000>;
+   status = "okay";
+
+   dai-link-0 {
+   sound-dai = < AIU_CPU CPU_I2S_FIFO>;
+   };
+
+   dai-link-1 {
+   sound-dai = < AIU_CPU CPU_I2S_ENCODER>;
+   dai-format = "i2s";
+   mclk-fs = <256>;
+
+   codec-0 {
+   sound-dai = < AIU_HDMI CTRL_I2S>;
+   };
+   };
+
+   dai-link-2 {
+   sound-dai = < AIU_HDMI CTRL_OUT>;
+
+   codec-0 {
+   sound-dai = <_tx>;
+   };
+   };
+   };
+};
+
+ {
+   status = "okay";
 };
 
 _AO {
-- 
2.17.1



[PATCH] arm64: dts: meson: add i2c3/rtc nodes and vrtc alias to GT-King/GT-King-Pro

2020-11-30 Thread Christian Hewitt
The GT-King and GT-King-Pro boxes have an RTC chip and power cell, so enable it.

GTKING:~ # dmesg | grep rtc
[5.237245] meson-vrtc ff8000a8.rtc: registered as rtc1
[5.261869] rtc-hym8563 0-0051: registered as rtc0
[5.265016] rtc-hym8563 0-0051: setting system clock to 2020-11-30T09:16:54 
UTC (1606727814)

Signed-off-by: Christian Hewitt 
---
 .../boot/dts/amlogic/meson-g12b-gtking-pro.dts | 17 +
 .../boot/dts/amlogic/meson-g12b-gtking.dts | 18 ++
 2 files changed, 35 insertions(+)

diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-gtking-pro.dts 
b/arch/arm64/boot/dts/amlogic/meson-g12b-gtking-pro.dts
index f0c56a16af3d..0e5c500fb78f 100644
--- a/arch/arm64/boot/dts/amlogic/meson-g12b-gtking-pro.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-gtking-pro.dts
@@ -14,6 +14,11 @@
compatible = "azw,gtking", "amlogic,g12b";
model = "Beelink GT-King Pro";
 
+   aliases {
+   rtc0 = 
+   rtc1 = 
+   };
+
gpio-keys-polled {
compatible = "gpio-keys-polled";
#address-cells = <1>;
@@ -112,6 +117,18 @@
status = "okay";
 };
 
+ {
+   status = "okay";
+   pinctrl-0 = <_sda_a_pins>, <_sck_a_pins>;
+   pinctrl-names = "default";
+
+   rtc: rtc@51 {
+   compatible = "nxp,pcf8563";
+   reg = <0x51>;
+   wakeup-source;
+   };
+};
+
 _b {
status = "okay";
 };
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-gtking.dts 
b/arch/arm64/boot/dts/amlogic/meson-g12b-gtking.dts
index eeb7bc5539ef..10b87eb97b14 100644
--- a/arch/arm64/boot/dts/amlogic/meson-g12b-gtking.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-gtking.dts
@@ -14,6 +14,11 @@
compatible = "azw,gtking", "amlogic,g12b";
model = "Beelink GT-King";
 
+   aliases {
+   rtc0 = 
+   rtc1 = 
+   };
+
spdif_dit: audio-codec-1 {
#sound-dai-cells = <0>;
compatible = "linux,spdif-dit";
@@ -122,6 +127,19 @@
status = "okay";
 };
 
+
+ {
+   status = "okay";
+   pinctrl-0 = <_sda_a_pins>, <_sck_a_pins>;
+   pinctrl-names = "default";
+
+   rtc: rtc@51 {
+   compatible = "nxp,pcf8563";
+   reg = <0x51>;
+   wakeup-source;
+   };
+};
+
  {
pinctrl-0 = <_out_h_pins>;
pinctrl-names = "default";
-- 
2.17.1



[PATCH v3] media: rc: add keymap for pine64 remote

2020-11-26 Thread Christian Hewitt
From: Jonas Karlman 

Add a keymap for the pine64 IR remote [0]. The mouse key has been mapped to
KEY_EPG to provide a more useful remote.

[0] http://files.pine64.org/doc/Pine%20A64%20Schematic/remote-wit-logo.jpg

Signed-off-by: Jonas Karlman 
Signed-off-by: Christian Hewitt 
---
Changes since v2:
- added missing rc-map.h change

Changes since v1 [1]:
- reorder code to match the physical layout
- assign KEY_EPG instead of KEY_CONTEXT_MENU

KEY_CONTEXT_MENU duplicates KEY_MENU, and while Seans suggestion of BTN_LEFT
visually matches the key, this duplicates KEY_OK in most GUI's designed for
remote naviagation, e.g. Kodi and Plex. I've chosen to map KEY_EPG as this
is a common tweak in user forums to extend IR remote functionality.

[1] 
https://patchwork.kernel.org/project/linux-media/patch/am3pr03mb09661a45feb90ffc3cb44508ac...@am3pr03mb0966.eurprd03.prod.outlook.com/

 .../devicetree/bindings/media/rc.yaml |  1 +
 drivers/media/rc/keymaps/Makefile |  1 +
 drivers/media/rc/keymaps/rc-pine64.c  | 65 +++
 include/media/rc-map.h|  1 +
 4 files changed, 68 insertions(+)
 create mode 100644 drivers/media/rc/keymaps/rc-pine64.c

diff --git a/Documentation/devicetree/bindings/media/rc.yaml 
b/Documentation/devicetree/bindings/media/rc.yaml
index 03cf40f91d6c..946441b4e1a5 100644
--- a/Documentation/devicetree/bindings/media/rc.yaml
+++ b/Documentation/devicetree/bindings/media/rc.yaml
@@ -103,6 +103,7 @@ properties:
   - rc-npgtech
   - rc-odroid
   - rc-pctv-sedna
+  - rc-pine64
   - rc-pinnacle-color
   - rc-pinnacle-grey
   - rc-pinnacle-pctv-hd
diff --git a/drivers/media/rc/keymaps/Makefile 
b/drivers/media/rc/keymaps/Makefile
index 1c4d6bec0ae4..b252a1d2ebd6 100644
--- a/drivers/media/rc/keymaps/Makefile
+++ b/drivers/media/rc/keymaps/Makefile
@@ -80,6 +80,7 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \
rc-npgtech.o \
rc-odroid.o \
rc-pctv-sedna.o \
+   rc-pine64.o \
rc-pinnacle-color.o \
rc-pinnacle-grey.o \
rc-pinnacle-pctv-hd.o \
diff --git a/drivers/media/rc/keymaps/rc-pine64.c 
b/drivers/media/rc/keymaps/rc-pine64.c
new file mode 100644
index ..9b2bdbbce04e
--- /dev/null
+++ b/drivers/media/rc/keymaps/rc-pine64.c
@@ -0,0 +1,65 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+// Keytable for the Pine64 IR Remote Controller
+// Copyright (c) 2017 Jonas Karlman
+
+#include 
+#include 
+
+static struct rc_map_table pine64[] = {
+   { 0x40404d, KEY_POWER },
+   { 0x40401f, KEY_WWW },
+   { 0x40400a, KEY_MUTE },
+
+   { 0x404017, KEY_VOLUMEDOWN },
+   { 0x404018, KEY_VOLUMEUP },
+
+   { 0x404010, KEY_LEFT },
+   { 0x404011, KEY_RIGHT },
+   { 0x40400b, KEY_UP },
+   { 0x40400e, KEY_DOWN },
+   { 0x40400d, KEY_OK },
+
+   { 0x40401d, KEY_MENU },
+   { 0x40401a, KEY_HOME },
+
+   { 0x404045, KEY_BACK },
+
+   { 0x404001, KEY_NUMERIC_1 },
+   { 0x404002, KEY_NUMERIC_2 },
+   { 0x404003, KEY_NUMERIC_3 },
+   { 0x404004, KEY_NUMERIC_4 },
+   { 0x404005, KEY_NUMERIC_5 },
+   { 0x404006, KEY_NUMERIC_6 },
+   { 0x404007, KEY_NUMERIC_7 },
+   { 0x404008, KEY_NUMERIC_8 },
+   { 0x404009, KEY_NUMERIC_9 },
+   { 0x40400c, KEY_BACKSPACE },
+   { 0x404000, KEY_NUMERIC_0 },
+   { 0x404047, KEY_EPG }, // mouse
+};
+
+static struct rc_map_list pine64_map = {
+   .map = {
+   .scan = pine64,
+   .size = ARRAY_SIZE(pine64),
+   .rc_proto = RC_PROTO_NECX,
+   .name = RC_MAP_PINE64,
+   }
+};
+
+static int __init init_rc_map_pine64(void)
+{
+   return rc_map_register(_map);
+}
+
+static void __exit exit_rc_map_pine64(void)
+{
+   rc_map_unregister(_map);
+}
+
+module_init(init_rc_map_pine64)
+module_exit(exit_rc_map_pine64)
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Jonas Karlman");
diff --git a/include/media/rc-map.h b/include/media/rc-map.h
index fa270f16a97b..999b750bc6b8 100644
--- a/include/media/rc-map.h
+++ b/include/media/rc-map.h
@@ -283,6 +283,7 @@ struct rc_map *rc_map_get(const char *name);
 #define RC_MAP_NPGTECH   "rc-npgtech"
 #define RC_MAP_ODROID"rc-odroid"
 #define RC_MAP_PCTV_SEDNA"rc-pctv-sedna"
+#define RC_MAP_PINE64"rc-pine64"
 #define RC_MAP_PINNACLE_COLOR"rc-pinnacle-color"
 #define RC_MAP_PINNACLE_GREY "rc-pinnacle-grey"
 #define RC_MAP_PINNACLE_PCTV_HD  "rc-pinnacle-pctv-hd"
-- 
2.17.1



[PATCH v2] media: rc: add keymap for pine64 remote

2020-11-26 Thread Christian Hewitt
From: Jonas Karlman 

Add a keymap for the pine64 IR remote [0]. The mouse key has been mapped to
KEY_EPG to provide a more useful remote.

[0] http://files.pine64.org/doc/Pine%20A64%20Schematic/remote-wit-logo.jpg

Signed-off-by: Jonas Karlman 
Signed-off-by: Christian Hewitt 
---
Changes since v1 [1]:
- reorder code to match the physical layout
- assign KEY_EPG instead of KEY_CONTEXT_MENU

KEY_CONTEXT_MENU duplicates KEY_MENU, and while Seans suggestion of BTN_LEFT
visually matches the key, this duplicates KEY_OK in most GUI's designed for
remote naviagation, e.g. Kodi and Plex. I've chosen to map KEY_EPG as this
is a common tweak in user forums to extend IR remote functionality.

[1] 
https://patchwork.kernel.org/project/linux-media/patch/am3pr03mb09661a45feb90ffc3cb44508ac...@am3pr03mb0966.eurprd03.prod.outlook.com/

 .../devicetree/bindings/media/rc.yaml |  1 +
 drivers/media/rc/keymaps/Makefile |  1 +
 drivers/media/rc/keymaps/rc-pine64.c  | 65 +++
 3 files changed, 67 insertions(+)
 create mode 100644 drivers/media/rc/keymaps/rc-pine64.c

diff --git a/Documentation/devicetree/bindings/media/rc.yaml 
b/Documentation/devicetree/bindings/media/rc.yaml
index 03cf40f91d6c..946441b4e1a5 100644
--- a/Documentation/devicetree/bindings/media/rc.yaml
+++ b/Documentation/devicetree/bindings/media/rc.yaml
@@ -103,6 +103,7 @@ properties:
   - rc-npgtech
   - rc-odroid
   - rc-pctv-sedna
+  - rc-pine64
   - rc-pinnacle-color
   - rc-pinnacle-grey
   - rc-pinnacle-pctv-hd
diff --git a/drivers/media/rc/keymaps/Makefile 
b/drivers/media/rc/keymaps/Makefile
index 1c4d6bec0ae4..b252a1d2ebd6 100644
--- a/drivers/media/rc/keymaps/Makefile
+++ b/drivers/media/rc/keymaps/Makefile
@@ -80,6 +80,7 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \
rc-npgtech.o \
rc-odroid.o \
rc-pctv-sedna.o \
+   rc-pine64.o \
rc-pinnacle-color.o \
rc-pinnacle-grey.o \
rc-pinnacle-pctv-hd.o \
diff --git a/drivers/media/rc/keymaps/rc-pine64.c 
b/drivers/media/rc/keymaps/rc-pine64.c
new file mode 100644
index ..9b2bdbbce04e
--- /dev/null
+++ b/drivers/media/rc/keymaps/rc-pine64.c
@@ -0,0 +1,65 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+// Keytable for the Pine64 IR Remote Controller
+// Copyright (c) 2017 Jonas Karlman
+
+#include 
+#include 
+
+static struct rc_map_table pine64[] = {
+   { 0x40404d, KEY_POWER },
+   { 0x40401f, KEY_WWW },
+   { 0x40400a, KEY_MUTE },
+
+   { 0x404017, KEY_VOLUMEDOWN },
+   { 0x404018, KEY_VOLUMEUP },
+
+   { 0x404010, KEY_LEFT },
+   { 0x404011, KEY_RIGHT },
+   { 0x40400b, KEY_UP },
+   { 0x40400e, KEY_DOWN },
+   { 0x40400d, KEY_OK },
+
+   { 0x40401d, KEY_MENU },
+   { 0x40401a, KEY_HOME },
+
+   { 0x404045, KEY_BACK },
+
+   { 0x404001, KEY_NUMERIC_1 },
+   { 0x404002, KEY_NUMERIC_2 },
+   { 0x404003, KEY_NUMERIC_3 },
+   { 0x404004, KEY_NUMERIC_4 },
+   { 0x404005, KEY_NUMERIC_5 },
+   { 0x404006, KEY_NUMERIC_6 },
+   { 0x404007, KEY_NUMERIC_7 },
+   { 0x404008, KEY_NUMERIC_8 },
+   { 0x404009, KEY_NUMERIC_9 },
+   { 0x40400c, KEY_BACKSPACE },
+   { 0x404000, KEY_NUMERIC_0 },
+   { 0x404047, KEY_EPG }, // mouse
+};
+
+static struct rc_map_list pine64_map = {
+   .map = {
+   .scan = pine64,
+   .size = ARRAY_SIZE(pine64),
+   .rc_proto = RC_PROTO_NECX,
+   .name = RC_MAP_PINE64,
+   }
+};
+
+static int __init init_rc_map_pine64(void)
+{
+   return rc_map_register(_map);
+}
+
+static void __exit exit_rc_map_pine64(void)
+{
+   rc_map_unregister(_map);
+}
+
+module_init(init_rc_map_pine64)
+module_exit(exit_rc_map_pine64)
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Jonas Karlman");
-- 
2.17.1



[PATCH] arm64: dts: meson: add KHAMSIN IR remote node to SML5442TW

2020-11-25 Thread Christian Hewitt
Set the IR keymap to the KHAMSIN remote shipped with the SML5442TW.

Signed-off-by: Christian Hewitt 
---
The rc-khamsin keymap is queued (or in the process of being picked) via the
media tree [0] so it would be nice to add this within the 5.11 cycle.

[0] 
https://patchwork.linuxtv.org/project/linux-media/patch/20201125161413.ga...@gofer.mess.org/

 arch/arm64/boot/dts/amlogic/meson-gxl-s905d-sml5442tw.dts | 4 
 1 file changed, 4 insertions(+)

diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905d-sml5442tw.dts 
b/arch/arm64/boot/dts/amlogic/meson-gxl-s905d-sml5442tw.dts
index 0b95e9ecbef0..ad6d72254150 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxl-s905d-sml5442tw.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905d-sml5442tw.dts
@@ -63,6 +63,10 @@
pinctrl-names = "default";
 };
 
+ {
+linux,rc-map-name = "rc-khamsin";
+};
+
 /* This is connected to the Bluetooth module: */
 _A {
status = "okay";
-- 
2.17.1



[PATCH v2] media: rc: add keymap for KHAMSIN remote

2020-11-25 Thread Christian Hewitt
This remote ships with the Amlogic SML-5442TW IPTV/VOD Set-Top Box
used by O2.cz. This keymap adds support for the default IR controls.

Signed-off-by: Christian Hewitt 
---

v2 changes:
- added rc.yaml bindings
- fixed typos and removed stray URL reference

 .../devicetree/bindings/media/rc.yaml |  1 +
 drivers/media/rc/keymaps/Makefile |  1 +
 drivers/media/rc/keymaps/rc-khamsin.c | 75 +++
 include/media/rc-map.h|  1 +
 4 files changed, 78 insertions(+)
 create mode 100644 drivers/media/rc/keymaps/rc-khamsin.c

diff --git a/Documentation/devicetree/bindings/media/rc.yaml 
b/Documentation/devicetree/bindings/media/rc.yaml
index 8ad2cba5f61f..03cf40f91d6c 100644
--- a/Documentation/devicetree/bindings/media/rc.yaml
+++ b/Documentation/devicetree/bindings/media/rc.yaml
@@ -83,6 +83,7 @@ properties:
   - rc-it913x-v2
   - rc-kaiomy
   - rc-khadas
+  - rc-khamsin
   - rc-kworld-315u
   - rc-kworld-pc150u
   - rc-kworld-plus-tv-analog
diff --git a/drivers/media/rc/keymaps/Makefile 
b/drivers/media/rc/keymaps/Makefile
index aaa1bf81d00d..1c4d6bec0ae4 100644
--- a/drivers/media/rc/keymaps/Makefile
+++ b/drivers/media/rc/keymaps/Makefile
@@ -60,6 +60,7 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \
rc-it913x-v2.o \
rc-kaiomy.o \
rc-khadas.o \
+   rc-khamsin.o \
rc-kworld-315u.o \
rc-kworld-pc150u.o \
rc-kworld-plus-tv-analog.o \
diff --git a/drivers/media/rc/keymaps/rc-khamsin.c 
b/drivers/media/rc/keymaps/rc-khamsin.c
new file mode 100644
index ..0c98c2faacff
--- /dev/null
+++ b/drivers/media/rc/keymaps/rc-khamsin.c
@@ -0,0 +1,75 @@
+// SPDX-License-Identifier: GPL-2.0+
+// Copyright (c) 2020 Christian Hewitt
+
+#include 
+#include 
+
+/*
+ * KHAMSIN is an IR/Bluetooth RCU supplied with the SmartLabs
+ * SML-5442TW DVB-S/VOD box. The RCU has separate IR (TV) and
+ * BT (STB) modes. This keymap suppors the IR controls.
+ */
+
+static struct rc_map_table khamsin[] = {
+   { 0x70702, KEY_POWER},
+
+   { 0x70701, KEY_VIDEO}, // source
+
+   { 0x7076c, KEY_RED},
+   { 0x70714, KEY_GREEN},
+   { 0x70715, KEY_YELLOW},
+   { 0x70716, KEY_BLUE},
+
+   { 0x7071a, KEY_MENU},
+   { 0x7074f, KEY_EPG},
+
+   { 0x70760, KEY_UP },
+   { 0x70761, KEY_DOWN },
+   { 0x70765, KEY_LEFT },
+   { 0x70762, KEY_RIGHT },
+   { 0x70768, KEY_ENTER },
+
+   { 0x7072d, KEY_ESC }, // back
+
+   { 0x70707, KEY_VOLUMEUP },
+   { 0x7070b, KEY_VOLUMEDOWN },
+   { 0x7070f, KEY_MUTE },
+   { 0x70712, KEY_CHANNELUP },
+   { 0x70710, KEY_CHANNELDOWN },
+
+   { 0x70704, KEY_1 },
+   { 0x70705, KEY_2 },
+   { 0x70706, KEY_3 },
+   { 0x70708, KEY_4 },
+   { 0x70709, KEY_5 },
+   { 0x7070a, KEY_6 },
+   { 0x7070c, KEY_7 },
+   { 0x7070d, KEY_8 },
+   { 0x7070e, KEY_9 },
+   { 0x70711, KEY_0 },
+};
+
+static struct rc_map_list khamsin_map = {
+   .map = {
+   .scan = khamsin,
+   .size = ARRAY_SIZE(khamsin),
+   .rc_proto = RC_PROTO_NECX,
+   .name = RC_MAP_KHAMSIN,
+   }
+};
+
+static int __init init_rc_map_khamsin(void)
+{
+   return rc_map_register(_map);
+}
+
+static void __exit exit_rc_map_khamsin(void)
+{
+   rc_map_unregister(_map);
+}
+
+module_init(init_rc_map_khamsin)
+module_exit(exit_rc_map_khamsin)
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Christian Hewitt ");
diff --git a/include/media/rc-map.h b/include/media/rc-map.h
index 7dbb91c601a7..fa270f16a97b 100644
--- a/include/media/rc-map.h
+++ b/include/media/rc-map.h
@@ -263,6 +263,7 @@ struct rc_map *rc_map_get(const char *name);
 #define RC_MAP_IT913X_V2 "rc-it913x-v2"
 #define RC_MAP_KAIOMY"rc-kaiomy"
 #define RC_MAP_KHADAS"rc-khadas"
+#define RC_MAP_KHAMSIN   "rc-khamsin"
 #define RC_MAP_KWORLD_315U   "rc-kworld-315u"
 #define RC_MAP_KWORLD_PC150U "rc-kworld-pc150u"
 #define RC_MAP_KWORLD_PLUS_TV_ANALOG "rc-kworld-plus-tv-analog"
-- 
2.17.1



[PATCH] arm64: dts: meson: update the Khadas VIM3/3L LED bindings

2020-11-24 Thread Christian Hewitt
Update the VIM3/3L common dtsi to use the new function/color bindings.

Suggested-by: Artem Lapkin 
Signed-off-by: Christian Hewitt 
---
This supersedes a previous submission from Art [0] and uses the updated
LED bindings suggested by Neil.

[0] 
https://patchwork.kernel.org/project/linux-amlogic/patch/20200925033017.1790973-4-...@khadas.com/

 arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi | 11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi 
b/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi
index 87bd8c9516f2..8f8656262ae7 100644
--- a/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi
@@ -6,6 +6,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 
@@ -42,14 +43,16 @@
leds {
compatible = "gpio-leds";
 
-   led-white {
-   label = "vim3:white:sys";
+   white {
+   color = ;
+   function = LED_FUNCTION_STATUS;
gpios = <_ao GPIOAO_4 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "heartbeat";
};
 
-   led-red {
-   label = "vim3:red";
+   red {
+   color = ;
+   function = LED_FUNCTION_STATUS;
gpios = <_expander 5 GPIO_ACTIVE_HIGH>;
};
};
-- 
2.17.1



[PATCH] arm64: dts: meson: fix spi-max-frequency on Khadas VIM2

2020-11-24 Thread Christian Hewitt
From: Artem Lapkin 

The max frequency for the w25q32 (VIM v1.2) and w25q128 (VIM v1.4) spifc
chip should be 104Mhz not 30MHz.

Fixes: b8b74dda3908 ("ARM64: dts: meson-gxm: Add support for Khadas VIM2")
Signed-off-by: Artem Lapkin 
---
This change was previously submitted as [0] which has style issues and
remains unmerged. It is also part of a two patch series where the other
patch needs further work to convert to newer LED bindings.

[0] 
https://patchwork.kernel.org/project/linux-amlogic/patch/20200928092613.273998-3-...@khadas.com/

 arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts 
b/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts
index 39e6047056b2..079500ed5066 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts
@@ -391,7 +391,7 @@
#size-cells = <1>;
compatible = "winbond,w25q16", "jedec,spi-nor";
reg = <0>;
-   spi-max-frequency = <300>;
+   spi-max-frequency = <10400>;
};
 };
 
-- 
2.17.1



[PATCH] arm64: dts: meson: add rtc aliases to meson-khadas-vim3.dtsi

2020-11-24 Thread Christian Hewitt
Tweak the node name to make it aliasable, then add aliases for the
on-board RTC chip and meson-vrtc timer so they probe as rtc0 and
rtc1 respectively.

before:

VIM3:~ # dmesg | grep rtc
[3.622530] meson-vrtc ff8000a8.rtc: registered as rtc0
[3.622574] meson-vrtc ff8000a8.rtc: setting system clock to 
1970-01-01T00:00:03 UTC (3)
[3.646936] rtc-hym8563 0-0051: no valid clock/calendar values available
[3.647125] rtc-hym8563 0-0051: registered as rtc1
[3.852382] rtc-hym8563 0-0051: no valid clock/calendar values available

after:

VIM3:~ # dmesg | grep rtc
[3.583735] meson-vrtc ff8000a8.rtc: registered as rtc1
[3.633888] rtc-hym8563 0-0051: no valid clock/calendar values available
[3.634120] rtc-hym8563 0-0051: registered as rtc0
[3.635250] rtc-hym8563 0-0051: no valid clock/calendar values available
[3.635267] rtc-hym8563 0-0051: hctosys: unable to read the hardware clock
[3.852632] rtc-hym8563 0-0051: no valid clock/calendar values available

Signed-off-by: Christian Hewitt 
---
 arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi 
b/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi
index 69e6c03a787c..8f8656262ae7 100644
--- a/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi
@@ -14,6 +14,8 @@
aliases {
serial0 = _AO;
ethernet0 = 
+   rtc0 = 
+   rtc1 = 
};
 
chosen {
@@ -333,7 +335,7 @@
#gpio-cells = <2>;
};
 
-   rtc@51 {
+   rtc: rtc@51 {
compatible = "haoyu,hym8563";
reg = <0x51>;
#clock-cells = <0>;
-- 
2.17.1



[PATCH] arm64: dts: meson: Add capacity-dmips-mhz attributes to GXM

2020-11-24 Thread Christian Hewitt
GXM (S912) is a big-little design with CPUs 0-3 clocked at 1.5GHz
and CPUs 4-7 at 1.0GHz. Adding capacity-dmips-mhz attributes allows
the scheduler to factor the different clock speeds into capacity
calculations and prefer the higher-clocked cluster to improve
overall performance.

This was inspired by the similar change for G12B [0] boards. The
diference here is that all cores are A53's so the same dmips-mhz
value is used.

VIM2:~ # cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_cur_freq
1512000
1512000
1512000
1512000
100
100
100
100

before:

VIM2:~ # cat /sys/devices/system/cpu/cpu*/cpu_capacity
1024
1024
1024
1024
1024
1024
1024
1024

after:

VIM2:~ # cat /sys/devices/system/cpu/cpu*/cpu_capacity
1024
1024
1024
1024
677
677
677
677

The after value matches my table-napkin calculation:

(100 / 1512000 = 0.661) * 1024 = 677

[0] 
https://github.com/torvalds/linux/commit/6eeaf4d2452ec8b1ece58776812140734fc2e088

Signed-off-by: Christian Hewitt 
---
 arch/arm64/boot/dts/amlogic/meson-gxm.dtsi | 20 
 1 file changed, 20 insertions(+)

diff --git a/arch/arm64/boot/dts/amlogic/meson-gxm.dtsi 
b/arch/arm64/boot/dts/amlogic/meson-gxm.dtsi
index fe4145112295..411cc312fc62 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxm.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-gxm.dtsi
@@ -42,11 +42,28 @@
};
};
 
+   cpu0: cpu@0 {
+   capacity-dmips-mhz = <1024>;
+   };
+
+   cpu1: cpu@1 {
+   capacity-dmips-mhz = <1024>;
+   };
+
+   cpu2: cpu@2 {
+   capacity-dmips-mhz = <1024>;
+   };
+
+   cpu3: cpu@3 {
+   capacity-dmips-mhz = <1024>;
+   };
+
cpu4: cpu@100 {
device_type = "cpu";
compatible = "arm,cortex-a53";
reg = <0x0 0x100>;
enable-method = "psci";
+   capacity-dmips-mhz = <1024>;
next-level-cache = <>;
clocks = <_dvfs 1>;
#cooling-cells = <2>;
@@ -57,6 +74,7 @@
compatible = "arm,cortex-a53";
reg = <0x0 0x101>;
enable-method = "psci";
+   capacity-dmips-mhz = <1024>;
next-level-cache = <>;
clocks = <_dvfs 1>;
#cooling-cells = <2>;
@@ -67,6 +85,7 @@
compatible = "arm,cortex-a53";
reg = <0x0 0x102>;
enable-method = "psci";
+   capacity-dmips-mhz = <1024>;
next-level-cache = <>;
clocks = <_dvfs 1>;
#cooling-cells = <2>;
@@ -77,6 +96,7 @@
compatible = "arm,cortex-a53";
reg = <0x0 0x103>;
enable-method = "psci";
+   capacity-dmips-mhz = <1024>;
next-level-cache = <>;
clocks = <_dvfs 1>;
#cooling-cells = <2>;
-- 
2.17.1



[PATCH] media: rc: add keymap for KHAMSIN remote

2020-11-19 Thread Christian Hewitt
This remote ships with the Amlogic SML-5442TW IPTV/VOD Set-tob Box [0]
used by O2.cz. This keymap adds support for the default IR controls.

Signed-off-by: Christian Hewitt 
---
 drivers/media/rc/keymaps/Makefile |  1 +
 drivers/media/rc/keymaps/rc-khamsin.c | 75 +++
 include/media/rc-map.h|  1 +
 3 files changed, 77 insertions(+)
 create mode 100644 drivers/media/rc/keymaps/rc-khamsin.c

diff --git a/drivers/media/rc/keymaps/Makefile 
b/drivers/media/rc/keymaps/Makefile
index aaa1bf81d00d..1c4d6bec0ae4 100644
--- a/drivers/media/rc/keymaps/Makefile
+++ b/drivers/media/rc/keymaps/Makefile
@@ -60,6 +60,7 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \
rc-it913x-v2.o \
rc-kaiomy.o \
rc-khadas.o \
+   rc-khamsin.o \
rc-kworld-315u.o \
rc-kworld-pc150u.o \
rc-kworld-plus-tv-analog.o \
diff --git a/drivers/media/rc/keymaps/rc-khamsin.c 
b/drivers/media/rc/keymaps/rc-khamsin.c
new file mode 100644
index ..8a397590009a
--- /dev/null
+++ b/drivers/media/rc/keymaps/rc-khamsin.c
@@ -0,0 +1,75 @@
+// SPDX-License-Identifier: GPL-2.0+
+// Copyright (c) 2020 Christian Hewitt
+
+#include 
+#include 
+
+/*
+ * KHAMSIN is an IR/Bluetooth RCU supplied with the SmartLabs
+ * SML-5442TW DVB-S/VOD box. The RCU has separate IR (TV) and
+ * BT (STB) modes. This keymap suppors the IR controls.
+ */
+
+static struct rc_map_table khamsin[] = {
+   { 0x70702, KEY_POWER},
+
+   { 0x70701, KEY_VIDEO}, // source
+
+   { 0x7076c, KEY_RED},
+   { 0x70714, KEY_GREEN},
+   { 0x70715, KEY_YELLOW},
+   { 0x70716, KEY_BLUE},
+
+   { 0x7071a, KEY_MENU},
+   { 0x7074f, KEY_EPG},
+
+   { 0x70760, KEY_UP },
+   { 0x70761, KEY_DOWN },
+   { 0x70765, KEY_LEFT },
+   { 0x70762, KEY_RIGHT },
+   { 0x70768, KEY_ENTER },
+
+   { 0x7072d, KEY_ESC }, // back
+
+   { 0x70707, KEY_VOLUMEUP },
+   { 0x7070b, KEY_VOLUMEDOWN },
+   { 0x7070f, KEY_MUTE },
+   { 0x70712, KEY_CHANNELUP },
+   { 0x70710, KEY_CHANNELDOWN },
+
+   { 0x70704, KEY_1 },
+   { 0x70705, KEY_2 },
+   { 0x70706, KEY_3 },
+   { 0x70708, KEY_4 },
+   { 0x70709, KEY_5 },
+   { 0x7070a, KEY_6 },
+   { 0x7070c, KEY_7 },
+   { 0x7070d, KEY_8 },
+   { 0x7070e, KEY_9 },
+   { 0x70711, KEY_0 },
+};
+
+static struct rc_map_list khamsin_map = {
+   .map = {
+   .scan = khamsin,
+   .size = ARRAY_SIZE(khamsin),
+   .rc_proto = RC_PROTO_NEC,
+   .name = RC_MAP_KHAMSIN,
+   }
+};
+
+static int __init init_rc_map_khamsin(void)
+{
+   return rc_map_register(_map);
+}
+
+static void __exit exit_rc_map_khamsin(void)
+{
+   rc_map_unregister(_map);
+}
+
+module_init(init_rc_map_khamsin)
+module_exit(exit_rc_map_khamsin)
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Christian Hewitt ");
diff --git a/include/media/rc-map.h b/include/media/rc-map.h
index 7dbb91c601a7..fa270f16a97b 100644
--- a/include/media/rc-map.h
+++ b/include/media/rc-map.h
@@ -263,6 +263,7 @@ struct rc_map *rc_map_get(const char *name);
 #define RC_MAP_IT913X_V2 "rc-it913x-v2"
 #define RC_MAP_KAIOMY"rc-kaiomy"
 #define RC_MAP_KHADAS"rc-khadas"
+#define RC_MAP_KHAMSIN   "rc-khamsin"
 #define RC_MAP_KWORLD_315U   "rc-kworld-315u"
 #define RC_MAP_KWORLD_PC150U "rc-kworld-pc150u"
 #define RC_MAP_KWORLD_PLUS_TV_ANALOG "rc-kworld-plus-tv-analog"
-- 
2.17.1



[PATCH] arm64: dts: meson: enable rtc node on Khadas VIM1/VIM2 boards

2020-11-15 Thread Christian Hewitt
Enable the rtc node on VIM1/VIM2 boards so users can simply attach a power
cell and use the on-board RTC without modifying the device-tree.

Cold boot with no cell attached is gracefully handled:

VIM2:~ # dmesg | grep rtc
[7.716150] rtc-hym8563 1-0051: no valid clock/calendar values available
[7.716957] rtc-hym8563 1-0051: registered as rtc0
[7.729850] rtc-hym8563 1-0051: no valid clock/calendar values available
[7.729877] rtc-hym8563 1-0051: hctosys: unable to read the hardware clock
[8.126768] rtc-hym8563 1-0051: no valid clock/calendar values available

Warm boot (and any boot with cell attached) recalls stored values resulting
in consistently faster (re)boot times:

VIM2:~ # dmesg | grep rtc
[7.441671] rtc-hym8563 1-0051: registered as rtc0
[7.442663] rtc-hym8563 1-0051: setting system clock to 2020-11-16T05:49:59 
UTC (1605505799)

Suggested-by: Artem Lapkin 
Signed-off-by: Christian Hewitt 
---

This supersedes other recent attempts by Art to make the same change [0]
and [1] which were rejected for lack of justification for the change and
leaving comments behind. I have been using the same changes in my own
tree for a while.

Christian

[0] 
https://patchwork.kernel.org/project/linux-amlogic/patch/20200925033017.1790973-8-...@khadas.com/
[1] 
https://patchwork.kernel.org/project/linux-amlogic/patch/20200925033017.1790973-9-...@khadas.com/

 arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts | 3 +--
 arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts  | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts 
b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts
index 8bcdffdf55d0..638a5992d760 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts
@@ -97,8 +97,7 @@
pinctrl-names = "default";
 
rtc: rtc@51 {
-   /* has to be enabled manually when a battery is connected: */
-   status = "disabled";
+   status = "okay";
compatible = "haoyu,hym8563";
reg = <0x51>;
#clock-cells = <0>;
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts 
b/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts
index bff8ec2c1c70..da000c10b945 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts
@@ -228,8 +228,7 @@
pinctrl-names = "default";
 
rtc: rtc@51 {
-   /* has to be enabled manually when a battery is connected: */
-   status = "disabled";
+   status = "okay";
compatible = "haoyu,hym8563";
reg = <0x51>;
#clock-cells = <0>;
-- 
2.17.1



[PATCH v3 1/7] arm64: dts: meson: add audio playback to a95x

2020-11-15 Thread Christian Hewitt
Add initial audio support limited to HDMI i2s.

Signed-off-by: Christian Hewitt 
---
 .../dts/amlogic/meson-gxbb-nexbox-a95x.dts| 40 +++
 1 file changed, 40 insertions(+)

diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-nexbox-a95x.dts 
b/arch/arm64/boot/dts/amlogic/meson-gxbb-nexbox-a95x.dts
index 67d901ed2fa3..b5b11cb9f393 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-nexbox-a95x.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-nexbox-a95x.dts
@@ -10,6 +10,7 @@
 #include "meson-gxbb.dtsi"
 #include 
 #include 
+#include 
 
 / {
compatible = "nexbox,a95x", "amlogic,meson-gxbb";
@@ -139,6 +140,45 @@
};
};
};
+
+   sound {
+   compatible = "amlogic,gx-sound-card";
+   model = "GXBB-NEXBOX-A95X";
+   assigned-clocks = < CLKID_MPLL0>,
+ < CLKID_MPLL1>,
+ < CLKID_MPLL2>;
+   assigned-clock-parents = <0>, <0>, <0>;
+   assigned-clock-rates = <294912000>,
+  <270950400>,
+  <393216000>;
+   status = "okay";
+
+   dai-link-0 {
+   sound-dai = < AIU_CPU CPU_I2S_FIFO>;
+   };
+
+   dai-link-1 {
+   sound-dai = < AIU_CPU CPU_I2S_ENCODER>;
+   dai-format = "i2s";
+   mclk-fs = <256>;
+
+   codec-0 {
+   sound-dai = < AIU_HDMI CTRL_I2S>;
+   };
+   };
+
+   dai-link-2 {
+   sound-dai = < AIU_HDMI CTRL_OUT>;
+
+   codec-0 {
+   sound-dai = <_tx>;
+   };
+   };
+   };
+};
+
+ {
+   status = "okay";
 };
 
 _vdac_port {
-- 
2.17.1



[PATCH v3 4/7] arm64: dts: meson: add audio playback to nanopi-k2

2020-11-15 Thread Christian Hewitt
Add initial audio support limited to HDMI i2s.

Signed-off-by: Christian Hewitt 
---
 .../boot/dts/amlogic/meson-gxbb-nanopi-k2.dts | 40 +++
 1 file changed, 40 insertions(+)

diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts 
b/arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts
index 7be3e354093b..8e5df00b06a2 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts
@@ -7,6 +7,7 @@
 
 #include "meson-gxbb.dtsi"
 #include 
+#include 
 
 / {
compatible = "friendlyarm,nanopi-k2", "amlogic,meson-gxbb";
@@ -130,6 +131,45 @@
};
};
};
+
+   sound {
+   compatible = "amlogic,gx-sound-card";
+   model = "GXBB-NANOPI-K2";
+   assigned-clocks = < CLKID_MPLL0>,
+ < CLKID_MPLL1>,
+ < CLKID_MPLL2>;
+   assigned-clock-parents = <0>, <0>, <0>;
+   assigned-clock-rates = <294912000>,
+  <270950400>,
+  <393216000>;
+   status = "okay";
+
+   dai-link-0 {
+   sound-dai = < AIU_CPU CPU_I2S_FIFO>;
+   };
+
+   dai-link-1 {
+   sound-dai = < AIU_CPU CPU_I2S_ENCODER>;
+   dai-format = "i2s";
+   mclk-fs = <256>;
+
+   codec-0 {
+   sound-dai = < AIU_HDMI CTRL_I2S>;
+   };
+   };
+
+   dai-link-2 {
+   sound-dai = < AIU_HDMI CTRL_OUT>;
+
+   codec-0 {
+   sound-dai = <_tx>;
+   };
+   };
+   };
+};
+
+ {
+   status = "okay";
 };
 
 _AO {
-- 
2.17.1



[PATCH v3 6/7] arm64: dts: meson: add audio playback to wetek-hub

2020-11-15 Thread Christian Hewitt
Add initial audio support limited to HDMI i2s.

Signed-off-by: Christian Hewitt 
---
 .../boot/dts/amlogic/meson-gxbb-wetek-hub.dts | 40 +++
 1 file changed, 40 insertions(+)

diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-hub.dts 
b/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-hub.dts
index 83b985bb015e..0c1570153842 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-hub.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-hub.dts
@@ -7,10 +7,50 @@
 /dts-v1/;
 
 #include "meson-gxbb-wetek.dtsi"
+#include 
 
 / {
compatible = "wetek,hub", "amlogic,meson-gxbb";
model = "WeTek Hub";
+
+   sound {
+   compatible = "amlogic,gx-sound-card";
+   model = "GXBB-WETEK-HUB";
+   assigned-clocks = < CLKID_MPLL0>,
+ < CLKID_MPLL1>,
+ < CLKID_MPLL2>;
+   assigned-clock-parents = <0>, <0>, <0>;
+   assigned-clock-rates = <294912000>,
+  <270950400>,
+  <393216000>;
+   status = "okay";
+
+   dai-link-0 {
+   sound-dai = < AIU_CPU CPU_I2S_FIFO>;
+   };
+
+   dai-link-1 {
+   sound-dai = < AIU_CPU CPU_I2S_ENCODER>;
+   dai-format = "i2s";
+   mclk-fs = <256>;
+
+   codec-0 {
+   sound-dai = < AIU_HDMI CTRL_I2S>;
+   };
+   };
+
+   dai-link-2 {
+   sound-dai = < AIU_HDMI CTRL_OUT>;
+
+   codec-0 {
+   sound-dai = <_tx>;
+   };
+   };
+   };
+};
+
+ {
+   status = "okay";
 };
 
  {
-- 
2.17.1



[PATCH v3 2/7] arm64: dts: meson: add audio playback to khadas-vim

2020-11-15 Thread Christian Hewitt
Add initial audio support limited to HDMI i2s.

Signed-off-by: Christian Hewitt 
---
 .../amlogic/meson-gxl-s905x-khadas-vim.dts| 43 ++-
 1 file changed, 41 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts 
b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts
index 8bcdffdf55d0..de5361f20cd6 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts
@@ -5,9 +5,9 @@
 
 /dts-v1/;
 
-#include 
-
 #include "meson-gxl-s905x-p212.dtsi"
+#include 
+#include 
 
 / {
compatible = "khadas,vim", "amlogic,s905x", "amlogic,meson-gxl";
@@ -63,6 +63,45 @@
};
};
};
+
+   sound {
+   compatible = "amlogic,gx-sound-card";
+   model = "GXL-KHADAS-VIM1";
+   assigned-clocks = < CLKID_MPLL0>,
+ < CLKID_MPLL1>,
+ < CLKID_MPLL2>;
+   assigned-clock-parents = <0>, <0>, <0>;
+   assigned-clock-rates = <294912000>,
+  <270950400>,
+  <393216000>;
+   status = "okay";
+
+   dai-link-0 {
+   sound-dai = < AIU_CPU CPU_I2S_FIFO>;
+   };
+
+   dai-link-1 {
+   sound-dai = < AIU_CPU CPU_I2S_ENCODER>;
+   dai-format = "i2s";
+   mclk-fs = <256>;
+
+   codec-0 {
+   sound-dai = < AIU_HDMI CTRL_I2S>;
+   };
+   };
+
+   dai-link-2 {
+   sound-dai = < AIU_HDMI CTRL_OUT>;
+
+   codec-0 {
+   sound-dai = <_tx>;
+   };
+   };
+   };
+};
+
+ {
+   status = "okay";
 };
 
 _AO {
-- 
2.17.1



[PATCH v3 7/7] arm64: dts: meson: add audio playback to wetek-play2

2020-11-15 Thread Christian Hewitt
Add initial support limited to HDMI i2s and SPDIF (LPCM).

Signed-off-by: Christian Hewitt 
---
 .../dts/amlogic/meson-gxbb-wetek-play2.dts| 61 +++
 1 file changed, 61 insertions(+)

diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-play2.dts 
b/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-play2.dts
index 2ab8a3d10079..f2562c7de67c 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-play2.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-play2.dts
@@ -8,11 +8,19 @@
 
 #include "meson-gxbb-wetek.dtsi"
 #include 
+#include 
 
 / {
compatible = "wetek,play2", "amlogic,meson-gxbb";
model = "WeTek Play 2";
 
+   spdif_dit: audio-codec-0 {
+   #sound-dai-cells = <0>;
+   compatible = "linux,spdif-dit";
+   status = "okay";
+   sound-name-prefix = "DIT";
+   };
+
leds {
led-wifi {
label = "wetek-play:wifi-status";
@@ -39,6 +47,59 @@
gpios = <_ao GPIOAO_3 GPIO_ACTIVE_LOW>;
};
};
+
+   sound {
+   compatible = "amlogic,gx-sound-card";
+   model = "GXBB-WETEK-PLAY2";
+   assigned-clocks = < CLKID_MPLL0>,
+ < CLKID_MPLL1>,
+ < CLKID_MPLL2>;
+   assigned-clock-parents = <0>, <0>, <0>;
+   assigned-clock-rates = <294912000>,
+  <270950400>,
+  <393216000>;
+   status = "okay";
+
+   dai-link-0 {
+   sound-dai = < AIU_CPU CPU_I2S_FIFO>;
+   };
+
+   dai-link-1 {
+   sound-dai = < AIU_CPU CPU_SPDIF_FIFO>;
+   };
+
+   dai-link-2 {
+   sound-dai = < AIU_CPU CPU_I2S_ENCODER>;
+   dai-format = "i2s";
+   mclk-fs = <256>;
+
+   codec-0 {
+   sound-dai = < AIU_HDMI CTRL_I2S>;
+   };
+   };
+
+   dai-link-3 {
+   sound-dai = < AIU_CPU CPU_SPDIF_ENCODER>;
+
+   codec-0 {
+   sound-dai = <_dit>;
+   };
+   };
+
+   dai-link-4 {
+   sound-dai = < AIU_HDMI CTRL_OUT>;
+
+   codec-0 {
+   sound-dai = <_tx>;
+   };
+   };
+   };
+};
+
+ {
+   status = "okay";
+   pinctrl-0 = <_out_y_pins>;
+   pinctrl-names = "default";
 };
 
 _A {
-- 
2.17.1



[PATCH v3 0/7] arm64: dts: meson: add more GX soundcards

2020-11-15 Thread Christian Hewitt
This series adds basic support for LPCM audio over HDMI and S/PDIF
to GXBB/GXL/GXM devices that I own and have tested with. Audio can
be extended in the future (some devices have DACs and headphone
hardware to connect) but this gets the basics working.

Changes from v2
- Drop p200/p201/p212-s905x/vega-s95 changes
- Add khadas-vim(1)

Changes from v1
- Drop nexbox-a1 and rbox-pro 

Christian Hewitt (7):
  arm64: dts: meson: add audio playback to a95x
  arm64: dts: meson: add audio playback to khadas-vim
  arm64: dts: meson: add audio playback to khadas-vim2
  arm64: dts: meson: add audio playback to nanopi-k2
  arm64: dts: meson: add audio playback to odroid-c2
  arm64: dts: meson: add audio playback to wetek-hub
  arm64: dts: meson: add audio playback to wetek-play2

 .../boot/dts/amlogic/meson-gxbb-nanopi-k2.dts | 40 
 .../dts/amlogic/meson-gxbb-nexbox-a95x.dts| 40 
 .../boot/dts/amlogic/meson-gxbb-odroidc2.dts  | 40 
 .../boot/dts/amlogic/meson-gxbb-wetek-hub.dts | 40 
 .../dts/amlogic/meson-gxbb-wetek-play2.dts| 61 +++
 .../amlogic/meson-gxl-s905x-khadas-vim.dts| 43 -
 .../dts/amlogic/meson-gxm-khadas-vim2.dts | 44 -
 7 files changed, 303 insertions(+), 5 deletions(-)

-- 
2.17.1


[PATCH v3 3/7] arm64: dts: meson: add audio playback to khadas-vim2

2020-11-15 Thread Christian Hewitt
Add initial audio support limited to HDMI i2s.

Signed-off-by: Christian Hewitt 
---
 .../dts/amlogic/meson-gxm-khadas-vim2.dts | 44 +--
 1 file changed, 41 insertions(+), 3 deletions(-)

diff --git a/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts 
b/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts
index bff8ec2c1c70..d4734220443c 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts
@@ -7,9 +7,9 @@
 
 /dts-v1/;
 
-#include 
-
 #include "meson-gxm.dtsi"
+#include 
+#include 
 
 / {
compatible = "khadas,vim2", "amlogic,s912", "amlogic,meson-gxm";
@@ -145,6 +145,45 @@
clock-frequency = <32768>;
pwms = <_ef 0 30518 0>; /* PWM_E at 32.768KHz */
};
+
+   sound {
+   compatible = "amlogic,gx-sound-card";
+   model = "GXM-KHADAS-VIM2";
+   assigned-clocks = < CLKID_MPLL0>,
+ < CLKID_MPLL1>,
+ < CLKID_MPLL2>;
+   assigned-clock-parents = <0>, <0>, <0>;
+   assigned-clock-rates = <294912000>,
+  <270950400>,
+  <393216000>;
+   status = "okay";
+
+   dai-link-0 {
+   sound-dai = < AIU_CPU CPU_I2S_FIFO>;
+   };
+
+   dai-link-1 {
+   sound-dai = < AIU_CPU CPU_I2S_ENCODER>;
+   dai-format = "i2s";
+   mclk-fs = <256>;
+
+   codec-0 {
+   sound-dai = < AIU_HDMI CTRL_I2S>;
+   };
+   };
+
+   dai-link-2 {
+   sound-dai = < AIU_HDMI CTRL_OUT>;
+
+   codec-0 {
+   sound-dai = <_tx>;
+   };
+   };
+   };
+};
+
+ {
+   status = "okay";
 };
 
 _AO {
@@ -154,7 +193,6 @@
hdmi-phandle = <_tx>;
 };
 
-
 _cooling_maps {
map0 {
cooling-device = <_fan THERMAL_NO_LIMIT 1>;
-- 
2.17.1



[PATCH v3 5/7] arm64: dts: meson: add audio playback to odroid-c2

2020-11-15 Thread Christian Hewitt
Add initial audio support limited to HDMI i2s.

Signed-off-by: Christian Hewitt 
---
 .../boot/dts/amlogic/meson-gxbb-odroidc2.dts  | 40 +++
 1 file changed, 40 insertions(+)

diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts 
b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts
index 70fcfb7b0683..9d8c919c6e19 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts
@@ -9,6 +9,7 @@
 
 #include "meson-gxbb.dtsi"
 #include 
+#include 
 
 / {
compatible = "hardkernel,odroid-c2", "amlogic,meson-gxbb";
@@ -172,6 +173,45 @@
};
};
};
+
+   sound {
+   compatible = "amlogic,gx-sound-card";
+   model = "GXBB-ODROID-C2";
+   assigned-clocks = < CLKID_MPLL0>,
+ < CLKID_MPLL1>,
+ < CLKID_MPLL2>;
+   assigned-clock-parents = <0>, <0>, <0>;
+   assigned-clock-rates = <294912000>,
+  <270950400>,
+  <393216000>;
+   status = "okay";
+
+   dai-link-0 {
+   sound-dai = < AIU_CPU CPU_I2S_FIFO>;
+   };
+
+   dai-link-1 {
+   sound-dai = < AIU_CPU CPU_I2S_ENCODER>;
+   dai-format = "i2s";
+   mclk-fs = <256>;
+
+   codec-0 {
+   sound-dai = < AIU_HDMI CTRL_I2S>;
+   };
+   };
+
+   dai-link-2 {
+   sound-dai = < AIU_HDMI CTRL_OUT>;
+
+   codec-0 {
+   sound-dai = <_tx>;
+   };
+   };
+   };
+};
+
+ {
+   status = "okay";
 };
 
 _AO {
-- 
2.17.1



[PATCH] media: meson: vdec: add G12/SM1 to module description

2020-11-15 Thread Christian Hewitt
The meson vdec driver also supports Amlogic G12/SM1 hardware.

Signed-off-by: Christian Hewitt 
---
 drivers/staging/media/meson/vdec/vdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/media/meson/vdec/vdec.c 
b/drivers/staging/media/meson/vdec/vdec.c
index 5ccb3846c879..5d4db7a5b4b5 100644
--- a/drivers/staging/media/meson/vdec/vdec.c
+++ b/drivers/staging/media/meson/vdec/vdec.c
@@ -1131,6 +1131,6 @@ static struct platform_driver meson_vdec_driver = {
 };
 module_platform_driver(meson_vdec_driver);
 
-MODULE_DESCRIPTION("Meson video decoder driver for GXBB/GXL/GXM");
+MODULE_DESCRIPTION("Meson video decoder driver for GXBB/GXL/GXM/G12/SM1");
 MODULE_AUTHOR("Maxime Jourdan ");
 MODULE_LICENSE("GPL");
-- 
2.17.1



[PATCH] arm64: dts: meson: add watchdog to g12-common dtsi

2020-10-31 Thread Christian Hewitt
G12 vendor kernels show the watchdog on the same address as AXG
so add the node to meson-g12-common.dtsi. GX boards inherit the
same from meson-gx.dtsi.

v2 fix typo in node name (s/wtd/wdt)

Signed-off-by: Christian Hewitt 
---
 arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi 
b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
index 1e83ec5b8c91..314095b79a45 100644
--- a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
@@ -2179,6 +2179,12 @@
amlogic,channel-interrupts = <64 65 66 67 68 69 
70 71>;
};
 
+   watchdog: wdt@f0d0 {
+   compatible = "amlogic,meson-gxbb-wdt";
+   reg = <0x0 0xf0d0 0x0 0x10>;
+   clocks = <>;
+   };
+
spicc0: spi@13000 {
compatible = "amlogic,meson-g12a-spicc";
reg = <0x0 0x13000 0x0 0x44>;
-- 
2.17.1



[PATCH] arm64: dts: meson: add watchdog to g12-common dtsi

2020-10-30 Thread Christian Hewitt
G12 vendor kernels show the watchdog on the same address as AXG
so add the node to meson-g12-common.dtsi. GX boards inherit the
same from meson-gx.dtsi.

Signed-off-by: Christian Hewitt 
---
 arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi 
b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
index 1e83ec5b8c91..92afec3ffb2d 100644
--- a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
@@ -2179,6 +2179,12 @@
amlogic,channel-interrupts = <64 65 66 67 68 69 
70 71>;
};
 
+   watchdog: wtd@f0d0 {
+   compatible = "amlogic,meson-gxbb-wdt";
+   reg = <0x0 0xf0d0 0x0 0x10>;
+   clocks = <>;
+   };
+
spicc0: spi@13000 {
compatible = "amlogic,meson-g12a-spicc";
reg = <0x0 0x13000 0x0 0x44>;
-- 
2.17.1



[PATCH] arm64: dts: meson: remove empty lines from aml-s905x-cc v2 dts

2020-10-26 Thread Christian Hewitt
Fixes: 63fafc5a046b ("arm64: dts: meson: initial support for aml-s905x-cc v2")

Signed-off-by: Christian Hewitt 
---
 .../boot/dts/amlogic/meson-gxl-s905x-libretech-cc-v2.dts  | 4 
 1 file changed, 4 deletions(-)

diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc-v2.dts 
b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc-v2.dts
index 675eaa87963e..9a3c08e6e6cc 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc-v2.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc-v2.dts
@@ -84,7 +84,6 @@
regulator-always-on;
};
 
-
vcck: regulator-vcck {
compatible = "regulator-fixed";
regulator-name = "VCCK";
@@ -124,7 +123,6 @@
regulator-always-on;
};
 
-
vddio_card: regulator-vddio-card {
compatible = "regulator-gpio";
regulator-name = "VDDIO_CARD";
@@ -195,7 +193,6 @@
};
 };
 
-
  {
status = "okay";
 };
@@ -207,7 +204,6 @@
hdmi-phandle = <_tx>;
 };
 
-
  {
status = "okay";
 };
-- 
2.17.1



[PATCH] drm/panfrost: increase readl_relaxed_poll_timeout values

2020-10-08 Thread Christian Hewitt
Amlogic SoC devices report the following errors frequently causing excessive
dmesg log spam and early log rotataion, although the errors appear to be
harmless as everything works fine:

[7.202702] panfrost ffe4.gpu: error powering up gpu L2
[7.203760] panfrost ffe4.gpu: error powering up gpu shader

ARM staff have advised increasing the timeout values to eliminate the errors
in most normal scenarios, and testing with several different G31/G52 devices
shows 2 to be a reliable value.

Fixes: f3ba91228e8e ("drm/panfrost: Add initial panfrost driver")
Suggested-by: Steven Price 
Signed-off-by: Christian Hewitt 
---
 drivers/gpu/drm/panfrost/panfrost_gpu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/panfrost/panfrost_gpu.c 
b/drivers/gpu/drm/panfrost/panfrost_gpu.c
index e1b2a3376624..2aae636f1cf5 100644
--- a/drivers/gpu/drm/panfrost/panfrost_gpu.c
+++ b/drivers/gpu/drm/panfrost/panfrost_gpu.c
@@ -325,13 +325,13 @@ void panfrost_gpu_power_on(struct panfrost_device *pfdev)
/* Just turn on everything for now */
gpu_write(pfdev, L2_PWRON_LO, pfdev->features.l2_present);
ret = readl_relaxed_poll_timeout(pfdev->iomem + L2_READY_LO,
-   val, val == pfdev->features.l2_present, 100, 1000);
+   val, val == pfdev->features.l2_present, 100, 2);
if (ret)
dev_err(pfdev->dev, "error powering up gpu L2");
 
gpu_write(pfdev, SHADER_PWRON_LO, pfdev->features.shader_present);
ret = readl_relaxed_poll_timeout(pfdev->iomem + SHADER_READY_LO,
-   val, val == pfdev->features.shader_present, 100, 1000);
+   val, val == pfdev->features.shader_present, 100, 2);
if (ret)
dev_err(pfdev->dev, "error powering up gpu shader");
 
-- 
2.17.1



Re: [PATCH] arm64: dts: meson: add SM1 soundcard name to VIM3L

2020-10-02 Thread Christian Hewitt


> On 2 Oct 2020, at 6:44 pm, Jerome Brunet  wrote:
> 
> On Fri 02 Oct 2020 at 16:16, Christian Hewitt  
> wrote:
> 
>> VIM3L now inherits the sound node from the VIM3 common dtsi but is
>> an SM1 device, so label it as such, and stop users blaming future
>> support issues on the distro/app "wrongly detecting" their device.
>> 
>> Signed-off-by: Christian Hewitt 
>> ---
>> arch/arm64/boot/dts/amlogic/meson-sm1-khadas-vim3l.dts | 4 
>> 1 file changed, 4 insertions(+)
>> 
>> diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1-khadas-vim3l.dts 
>> b/arch/arm64/boot/dts/amlogic/meson-sm1-khadas-vim3l.dts
>> index 4b517ca72059..f46f0ecc37ec 100644
>> --- a/arch/arm64/boot/dts/amlogic/meson-sm1-khadas-vim3l.dts
>> +++ b/arch/arm64/boot/dts/amlogic/meson-sm1-khadas-vim3l.dts
>> @@ -32,6 +32,10 @@
>>  regulator-boot-on;
>>  regulator-always-on;
>>  };
>> +
>> +sound {
>> +model = "SM1-KHADAS-VIM3L";
>> +};
> 
> The sound card is the same so I don't see why the sm1 board should have
> a different name. If you are not happy with the name, please update it
> in the common file.

It’s a nice-to-have not a must-have, but the current LE images that are
in circulation use 5.7 with the previous board-correct name so I was
looking for continuity. We do see user forum reports (infrequent but
recurring) of wrongly detected hardware with other SoC platforms where
similar name inheritance surfaces the ‘wrong’ device name in GUIs, and
I like anything that avoids support work.

I’d suggest KHADAS-VIM3-VIM3L as a common name, but then it’s the only
device in the current device-tree set that is not prefixed with the SoC
identifier, which (OCD) feels wrong.

Christian

[PATCH v2 06/10] arm64: dts: meson: add audio playback to p200

2020-10-02 Thread Christian Hewitt
Add initial support limited to HDMI i2s and SPDIF (LPCM).

Signed-off-by: Christian Hewitt 
---
 .../boot/dts/amlogic/meson-gxbb-p200.dts  | 61 +++
 1 file changed, 61 insertions(+)

diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-p200.dts 
b/arch/arm64/boot/dts/amlogic/meson-gxbb-p200.dts
index 3c93d1898b40..a16dac72600d 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-p200.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-p200.dts
@@ -9,11 +9,19 @@
 
 #include "meson-gxbb-p20x.dtsi"
 #include 
+#include 
 
 / {
compatible = "amlogic,p200", "amlogic,meson-gxbb";
model = "Amlogic Meson GXBB P200 Development Board";
 
+   spdif_dit: audio-codec-0 {
+   #sound-dai-cells = <0>;
+   compatible = "linux,spdif-dit";
+   status = "okay";
+   sound-name-prefix = "DIT";
+   };
+
avdd18_usb_adc: regulator-avdd18_usb_adc {
compatible = "regulator-fixed";
regulator-name = "AVDD18_USB_ADC";
@@ -57,6 +65,59 @@
press-threshold-microvolt = <0>; /* 0% */
};
};
+
+   sound {
+   compatible = "amlogic,gx-sound-card";
+   model = "GXBB-P200";
+   assigned-clocks = < CLKID_MPLL0>,
+ < CLKID_MPLL1>,
+ < CLKID_MPLL2>;
+   assigned-clock-parents = <0>, <0>, <0>;
+   assigned-clock-rates = <294912000>,
+  <270950400>,
+  <393216000>;
+   status = "okay";
+
+   dai-link-0 {
+   sound-dai = < AIU_CPU CPU_I2S_FIFO>;
+   };
+
+   dai-link-1 {
+   sound-dai = < AIU_CPU CPU_SPDIF_FIFO>;
+   };
+
+   dai-link-2 {
+   sound-dai = < AIU_CPU CPU_I2S_ENCODER>;
+   dai-format = "i2s";
+   mclk-fs = <256>;
+
+   codec-0 {
+   sound-dai = < AIU_HDMI CTRL_I2S>;
+   };
+   };
+
+   dai-link-3 {
+   sound-dai = < AIU_CPU CPU_SPDIF_ENCODER>;
+
+   codec-0 {
+   sound-dai = <_dit>;
+   };
+   };
+
+   dai-link-4 {
+   sound-dai = < AIU_HDMI CTRL_OUT>;
+
+   codec-0 {
+   sound-dai = <_tx>;
+   };
+   };
+   };
+};
+
+ {
+   status = "okay";
+   pinctrl-0 = <_out_y_pins>;
+   pinctrl-names = "default";
 };
 
  {
-- 
2.17.1



[PATCH v2 09/10] arm64: dts: meson: add audio playback to wetek-hub

2020-10-02 Thread Christian Hewitt
Add initial audio support limited to HDMI i2s.

Signed-off-by: Christian Hewitt 
---
 .../boot/dts/amlogic/meson-gxbb-wetek-hub.dts | 40 +++
 1 file changed, 40 insertions(+)

diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-hub.dts 
b/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-hub.dts
index 83b985bb015e..0c1570153842 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-hub.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-hub.dts
@@ -7,10 +7,50 @@
 /dts-v1/;
 
 #include "meson-gxbb-wetek.dtsi"
+#include 
 
 / {
compatible = "wetek,hub", "amlogic,meson-gxbb";
model = "WeTek Hub";
+
+   sound {
+   compatible = "amlogic,gx-sound-card";
+   model = "GXBB-WETEK-HUB";
+   assigned-clocks = < CLKID_MPLL0>,
+ < CLKID_MPLL1>,
+ < CLKID_MPLL2>;
+   assigned-clock-parents = <0>, <0>, <0>;
+   assigned-clock-rates = <294912000>,
+  <270950400>,
+  <393216000>;
+   status = "okay";
+
+   dai-link-0 {
+   sound-dai = < AIU_CPU CPU_I2S_FIFO>;
+   };
+
+   dai-link-1 {
+   sound-dai = < AIU_CPU CPU_I2S_ENCODER>;
+   dai-format = "i2s";
+   mclk-fs = <256>;
+
+   codec-0 {
+   sound-dai = < AIU_HDMI CTRL_I2S>;
+   };
+   };
+
+   dai-link-2 {
+   sound-dai = < AIU_HDMI CTRL_OUT>;
+
+   codec-0 {
+   sound-dai = <_tx>;
+   };
+   };
+   };
+};
+
+ {
+   status = "okay";
 };
 
  {
-- 
2.17.1



[PATCH v2 04/10] arm64: dts: meson: add audio playback to odroid-c2

2020-10-02 Thread Christian Hewitt
Add initial audio support limited to HDMI i2s.

Signed-off-by: Christian Hewitt 
---
 .../boot/dts/amlogic/meson-gxbb-odroidc2.dts  | 40 +++
 1 file changed, 40 insertions(+)

diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts 
b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts
index 70fcfb7b0683..9d8c919c6e19 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts
@@ -9,6 +9,7 @@
 
 #include "meson-gxbb.dtsi"
 #include 
+#include 
 
 / {
compatible = "hardkernel,odroid-c2", "amlogic,meson-gxbb";
@@ -172,6 +173,45 @@
};
};
};
+
+   sound {
+   compatible = "amlogic,gx-sound-card";
+   model = "GXBB-ODROID-C2";
+   assigned-clocks = < CLKID_MPLL0>,
+ < CLKID_MPLL1>,
+ < CLKID_MPLL2>;
+   assigned-clock-parents = <0>, <0>, <0>;
+   assigned-clock-rates = <294912000>,
+  <270950400>,
+  <393216000>;
+   status = "okay";
+
+   dai-link-0 {
+   sound-dai = < AIU_CPU CPU_I2S_FIFO>;
+   };
+
+   dai-link-1 {
+   sound-dai = < AIU_CPU CPU_I2S_ENCODER>;
+   dai-format = "i2s";
+   mclk-fs = <256>;
+
+   codec-0 {
+   sound-dai = < AIU_HDMI CTRL_I2S>;
+   };
+   };
+
+   dai-link-2 {
+   sound-dai = < AIU_HDMI CTRL_OUT>;
+
+   codec-0 {
+   sound-dai = <_tx>;
+   };
+   };
+   };
+};
+
+ {
+   status = "okay";
 };
 
 _AO {
-- 
2.17.1



[PATCH v2 10/10] arm64: dts: meson: add audio playback to wetek-play2

2020-10-02 Thread Christian Hewitt
Add initial support limited to HDMI i2s and SPDIF (LPCM).

Signed-off-by: Christian Hewitt 
---
 .../dts/amlogic/meson-gxbb-wetek-play2.dts| 61 +++
 1 file changed, 61 insertions(+)

diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-play2.dts 
b/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-play2.dts
index 2ab8a3d10079..f2562c7de67c 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-play2.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-play2.dts
@@ -8,11 +8,19 @@
 
 #include "meson-gxbb-wetek.dtsi"
 #include 
+#include 
 
 / {
compatible = "wetek,play2", "amlogic,meson-gxbb";
model = "WeTek Play 2";
 
+   spdif_dit: audio-codec-0 {
+   #sound-dai-cells = <0>;
+   compatible = "linux,spdif-dit";
+   status = "okay";
+   sound-name-prefix = "DIT";
+   };
+
leds {
led-wifi {
label = "wetek-play:wifi-status";
@@ -39,6 +47,59 @@
gpios = <_ao GPIOAO_3 GPIO_ACTIVE_LOW>;
};
};
+
+   sound {
+   compatible = "amlogic,gx-sound-card";
+   model = "GXBB-WETEK-PLAY2";
+   assigned-clocks = < CLKID_MPLL0>,
+ < CLKID_MPLL1>,
+ < CLKID_MPLL2>;
+   assigned-clock-parents = <0>, <0>, <0>;
+   assigned-clock-rates = <294912000>,
+  <270950400>,
+  <393216000>;
+   status = "okay";
+
+   dai-link-0 {
+   sound-dai = < AIU_CPU CPU_I2S_FIFO>;
+   };
+
+   dai-link-1 {
+   sound-dai = < AIU_CPU CPU_SPDIF_FIFO>;
+   };
+
+   dai-link-2 {
+   sound-dai = < AIU_CPU CPU_I2S_ENCODER>;
+   dai-format = "i2s";
+   mclk-fs = <256>;
+
+   codec-0 {
+   sound-dai = < AIU_HDMI CTRL_I2S>;
+   };
+   };
+
+   dai-link-3 {
+   sound-dai = < AIU_CPU CPU_SPDIF_ENCODER>;
+
+   codec-0 {
+   sound-dai = <_dit>;
+   };
+   };
+
+   dai-link-4 {
+   sound-dai = < AIU_HDMI CTRL_OUT>;
+
+   codec-0 {
+   sound-dai = <_tx>;
+   };
+   };
+   };
+};
+
+ {
+   status = "okay";
+   pinctrl-0 = <_out_y_pins>;
+   pinctrl-names = "default";
 };
 
 _A {
-- 
2.17.1



[PATCH v2 08/10] arm64: dts: meson: add audio playback to vega-s95 dtsi

2020-10-02 Thread Christian Hewitt
Add initial support limited to HDMI i2s and SPDIF (LPCM).

Signed-off-by: Christian Hewitt 
---
 .../boot/dts/amlogic/meson-gxbb-vega-s95.dtsi | 61 +++
 1 file changed, 61 insertions(+)

diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi 
b/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi
index 222ee8069cfa..1300585a1ec7 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi
@@ -4,6 +4,7 @@
  */
 
 #include "meson-gxbb.dtsi"
+#include 
 
 / {
compatible = "tronsmart,vega-s95", "amlogic,meson-gxbb";
@@ -17,6 +18,13 @@
stdout-path = "serial0:115200n8";
};
 
+   spdif_dit: audio-codec-0 {
+   #sound-dai-cells = <0>;
+   compatible = "linux,spdif-dit";
+   status = "okay";
+   sound-name-prefix = "DIT";
+   };
+
leds {
compatible = "gpio-leds";
 
@@ -97,6 +105,59 @@
clocks = <>;
clock-names = "ext_clock";
};
+
+   sound {
+   compatible = "amlogic,gx-sound-card";
+   model = "GXBB-VEGA-S95";
+   assigned-clocks = < CLKID_MPLL0>,
+ < CLKID_MPLL1>,
+ < CLKID_MPLL2>;
+   assigned-clock-parents = <0>, <0>, <0>;
+   assigned-clock-rates = <294912000>,
+  <270950400>,
+  <393216000>;
+   status = "okay";
+
+   dai-link-0 {
+   sound-dai = < AIU_CPU CPU_I2S_FIFO>;
+   };
+
+   dai-link-1 {
+   sound-dai = < AIU_CPU CPU_SPDIF_FIFO>;
+   };
+
+   dai-link-2 {
+   sound-dai = < AIU_CPU CPU_I2S_ENCODER>;
+   dai-format = "i2s";
+   mclk-fs = <256>;
+
+   codec-0 {
+   sound-dai = < AIU_HDMI CTRL_I2S>;
+   };
+   };
+
+   dai-link-3 {
+   sound-dai = < AIU_CPU CPU_SPDIF_ENCODER>;
+
+   codec-0 {
+   sound-dai = <_dit>;
+   };
+   };
+
+   dai-link-4 {
+   sound-dai = < AIU_HDMI CTRL_OUT>;
+
+   codec-0 {
+   sound-dai = <_tx>;
+   };
+   };
+   };
+};
+
+ {
+   status = "okay";
+   pinctrl-0 = <_out_y_pins>;
+   pinctrl-names = "default";
 };
 
 _AO {
-- 
2.17.1



[PATCH v2 07/10] arm64: dts: meson: add audio playback to p212-s905x dtsi

2020-10-02 Thread Christian Hewitt
Add initial audio support limited to HDMI i2s.

Signed-off-by: Christian Hewitt 
---
 .../dts/amlogic/meson-gxl-s905x-p212.dtsi | 40 +++
 1 file changed, 40 insertions(+)

diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-p212.dtsi 
b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-p212.dtsi
index 05cb2f5e5c36..40776d42bf8e 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-p212.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-p212.dtsi
@@ -11,6 +11,7 @@
 /* Common DTSI for devices which are based on the P212 reference board. */
 
 #include "meson-gxl-s905x.dtsi"
+#include 
 
 / {
aliases {
@@ -85,6 +86,45 @@
clocks = <>;
clock-names = "ext_clock";
};
+
+   sound {
+   compatible = "amlogic,gx-sound-card";
+   model = "GXL-S905X-P212";
+   assigned-clocks = < CLKID_MPLL0>,
+ < CLKID_MPLL1>,
+ < CLKID_MPLL2>;
+   assigned-clock-parents = <0>, <0>, <0>;
+   assigned-clock-rates = <294912000>,
+  <270950400>,
+  <393216000>;
+   status = "okay";
+
+   dai-link-0 {
+   sound-dai = < AIU_CPU CPU_I2S_FIFO>;
+   };
+
+   dai-link-1 {
+   sound-dai = < AIU_CPU CPU_I2S_ENCODER>;
+   dai-format = "i2s";
+   mclk-fs = <256>;
+
+   codec-0 {
+   sound-dai = < AIU_HDMI CTRL_I2S>;
+   };
+   };
+
+   dai-link-2 {
+   sound-dai = < AIU_HDMI CTRL_OUT>;
+
+   codec-0 {
+   sound-dai = <_tx>;
+   };
+   };
+   };
+};
+
+ {
+   status = "okay";
 };
 
  {
-- 
2.17.1



[PATCH v2 01/10] arm64: dts: meson: add audio playback to a95x

2020-10-02 Thread Christian Hewitt
Add initial audio support limited to HDMI i2s.

Signed-off-by: Christian Hewitt 
---
 .../dts/amlogic/meson-gxbb-nexbox-a95x.dts| 40 +++
 1 file changed, 40 insertions(+)

diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-nexbox-a95x.dts 
b/arch/arm64/boot/dts/amlogic/meson-gxbb-nexbox-a95x.dts
index 67d901ed2fa3..b5b11cb9f393 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-nexbox-a95x.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-nexbox-a95x.dts
@@ -10,6 +10,7 @@
 #include "meson-gxbb.dtsi"
 #include 
 #include 
+#include 
 
 / {
compatible = "nexbox,a95x", "amlogic,meson-gxbb";
@@ -139,6 +140,45 @@
};
};
};
+
+   sound {
+   compatible = "amlogic,gx-sound-card";
+   model = "GXBB-NEXBOX-A95X";
+   assigned-clocks = < CLKID_MPLL0>,
+ < CLKID_MPLL1>,
+ < CLKID_MPLL2>;
+   assigned-clock-parents = <0>, <0>, <0>;
+   assigned-clock-rates = <294912000>,
+  <270950400>,
+  <393216000>;
+   status = "okay";
+
+   dai-link-0 {
+   sound-dai = < AIU_CPU CPU_I2S_FIFO>;
+   };
+
+   dai-link-1 {
+   sound-dai = < AIU_CPU CPU_I2S_ENCODER>;
+   dai-format = "i2s";
+   mclk-fs = <256>;
+
+   codec-0 {
+   sound-dai = < AIU_HDMI CTRL_I2S>;
+   };
+   };
+
+   dai-link-2 {
+   sound-dai = < AIU_HDMI CTRL_OUT>;
+
+   codec-0 {
+   sound-dai = <_tx>;
+   };
+   };
+   };
+};
+
+ {
+   status = "okay";
 };
 
 _vdac_port {
-- 
2.17.1



[PATCH v2 02/10] arm64: dts: meson: add audio playback to khadas-vim2

2020-10-02 Thread Christian Hewitt
Add initial audio support limited to HDMI i2s.

Signed-off-by: Christian Hewitt 
---
 .../dts/amlogic/meson-gxm-khadas-vim2.dts | 44 +--
 1 file changed, 41 insertions(+), 3 deletions(-)

diff --git a/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts 
b/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts
index bff8ec2c1c70..d4734220443c 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts
@@ -7,9 +7,9 @@
 
 /dts-v1/;
 
-#include 
-
 #include "meson-gxm.dtsi"
+#include 
+#include 
 
 / {
compatible = "khadas,vim2", "amlogic,s912", "amlogic,meson-gxm";
@@ -145,6 +145,45 @@
clock-frequency = <32768>;
pwms = <_ef 0 30518 0>; /* PWM_E at 32.768KHz */
};
+
+   sound {
+   compatible = "amlogic,gx-sound-card";
+   model = "GXM-KHADAS-VIM2";
+   assigned-clocks = < CLKID_MPLL0>,
+ < CLKID_MPLL1>,
+ < CLKID_MPLL2>;
+   assigned-clock-parents = <0>, <0>, <0>;
+   assigned-clock-rates = <294912000>,
+  <270950400>,
+  <393216000>;
+   status = "okay";
+
+   dai-link-0 {
+   sound-dai = < AIU_CPU CPU_I2S_FIFO>;
+   };
+
+   dai-link-1 {
+   sound-dai = < AIU_CPU CPU_I2S_ENCODER>;
+   dai-format = "i2s";
+   mclk-fs = <256>;
+
+   codec-0 {
+   sound-dai = < AIU_HDMI CTRL_I2S>;
+   };
+   };
+
+   dai-link-2 {
+   sound-dai = < AIU_HDMI CTRL_OUT>;
+
+   codec-0 {
+   sound-dai = <_tx>;
+   };
+   };
+   };
+};
+
+ {
+   status = "okay";
 };
 
 _AO {
@@ -154,7 +193,6 @@
hdmi-phandle = <_tx>;
 };
 
-
 _cooling_maps {
map0 {
cooling-device = <_fan THERMAL_NO_LIMIT 1>;
-- 
2.17.1



[PATCH v2 00/10] arm64: dts: meson: add more GX soundcards

2020-10-02 Thread Christian Hewitt
This series adds basic support for LPCM audio over HDMI and S/PDIF
interfaces to GXBB/GXL/GXM devices without support. I'm sure audio
support can be extended in places (some devices have internal DACs
and headphone hardware) but this gets the basics working.

I have personally tested with the khadas-vim2, odroid-c2, and both
wetek devices as I have them, and there are positive forum reports
from users with vega-s95 and some no-name P20X box devices.

Changes from v1
- Drop nexbox-a1 and rbox-pro changes - the regulator changes are
needed to get the dts to compile, but I do not have schematics to
validate the changes or the hardware to test with.

Christian Hewitt (10):
  arm64: dts: meson: add audio playback to a95x
  arm64: dts: meson: add audio playback to khadas-vim2
  arm64: dts: meson: add audio playback to nanopi-k2
  arm64: dts: meson: add audio playback to odroid-c2
  arm64: dts: meson: add audio playback to p201
  arm64: dts: meson: add audio playback to p200
  arm64: dts: meson: add audio playback to p212-s905x dtsi
  arm64: dts: meson: add audio playback to vega-s95 dtsi
  arm64: dts: meson: add audio playback to wetek-hub
  arm64: dts: meson: add audio playback to wetek-play2

 .../boot/dts/amlogic/meson-gxbb-nanopi-k2.dts | 40 
 .../dts/amlogic/meson-gxbb-nexbox-a95x.dts| 40 
 .../boot/dts/amlogic/meson-gxbb-odroidc2.dts  | 40 
 .../boot/dts/amlogic/meson-gxbb-p200.dts  | 61 +++
 .../boot/dts/amlogic/meson-gxbb-p201.dts  | 40 
 .../boot/dts/amlogic/meson-gxbb-vega-s95.dtsi | 61 +++
 .../boot/dts/amlogic/meson-gxbb-wetek-hub.dts | 40 
 .../dts/amlogic/meson-gxbb-wetek-play2.dts| 61 +++
 .../dts/amlogic/meson-gxl-s905x-p212.dtsi | 40 
 .../dts/amlogic/meson-gxm-khadas-vim2.dts | 44 -
 10 files changed, 464 insertions(+), 3 deletions(-)

-- 
2.17.1



[PATCH v2 05/10] arm64: dts: meson: add audio playback to p201

2020-10-02 Thread Christian Hewitt
Add initial audio support limited to HDMI i2s.

Signed-off-by: Christian Hewitt 
---
 .../boot/dts/amlogic/meson-gxbb-p201.dts  | 40 +++
 1 file changed, 40 insertions(+)

diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-p201.dts 
b/arch/arm64/boot/dts/amlogic/meson-gxbb-p201.dts
index 150a82f3b2d7..2e2bccbcfd43 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-p201.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-p201.dts
@@ -8,10 +8,50 @@
 /dts-v1/;
 
 #include "meson-gxbb-p20x.dtsi"
+#include 
 
 / {
compatible = "amlogic,p201", "amlogic,meson-gxbb";
model = "Amlogic Meson GXBB P201 Development Board";
+
+   sound {
+   compatible = "amlogic,gx-sound-card";
+   model = "GXBB-P201";
+   assigned-clocks = < CLKID_MPLL0>,
+ < CLKID_MPLL1>,
+ < CLKID_MPLL2>;
+   assigned-clock-parents = <0>, <0>, <0>;
+   assigned-clock-rates = <294912000>,
+  <270950400>,
+  <393216000>;
+   status = "okay";
+
+   dai-link-0 {
+   sound-dai = < AIU_CPU CPU_I2S_FIFO>;
+   };
+
+   dai-link-1 {
+   sound-dai = < AIU_CPU CPU_I2S_ENCODER>;
+   dai-format = "i2s";
+   mclk-fs = <256>;
+
+   codec-0 {
+   sound-dai = < AIU_HDMI CTRL_I2S>;
+   };
+   };
+
+   dai-link-2 {
+   sound-dai = < AIU_HDMI CTRL_OUT>;
+
+   codec-0 {
+   sound-dai = <_tx>;
+   };
+   };
+   };
+};
+
+ {
+   status = "okay";
 };
 
  {
-- 
2.17.1



[PATCH v2 03/10] arm64: dts: meson: add audio playback to nanopi-k2

2020-10-02 Thread Christian Hewitt
Add initial audio support limited to HDMI i2s.

Signed-off-by: Christian Hewitt 
---
 .../boot/dts/amlogic/meson-gxbb-nanopi-k2.dts | 40 +++
 1 file changed, 40 insertions(+)

diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts 
b/arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts
index 7be3e354093b..8e5df00b06a2 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts
@@ -7,6 +7,7 @@
 
 #include "meson-gxbb.dtsi"
 #include 
+#include 
 
 / {
compatible = "friendlyarm,nanopi-k2", "amlogic,meson-gxbb";
@@ -130,6 +131,45 @@
};
};
};
+
+   sound {
+   compatible = "amlogic,gx-sound-card";
+   model = "GXBB-NANOPI-K2";
+   assigned-clocks = < CLKID_MPLL0>,
+ < CLKID_MPLL1>,
+ < CLKID_MPLL2>;
+   assigned-clock-parents = <0>, <0>, <0>;
+   assigned-clock-rates = <294912000>,
+  <270950400>,
+  <393216000>;
+   status = "okay";
+
+   dai-link-0 {
+   sound-dai = < AIU_CPU CPU_I2S_FIFO>;
+   };
+
+   dai-link-1 {
+   sound-dai = < AIU_CPU CPU_I2S_ENCODER>;
+   dai-format = "i2s";
+   mclk-fs = <256>;
+
+   codec-0 {
+   sound-dai = < AIU_HDMI CTRL_I2S>;
+   };
+   };
+
+   dai-link-2 {
+   sound-dai = < AIU_HDMI CTRL_OUT>;
+
+   codec-0 {
+   sound-dai = <_tx>;
+   };
+   };
+   };
+};
+
+ {
+   status = "okay";
 };
 
 _AO {
-- 
2.17.1



[PATCH] arm64: dts: meson: add SM1 soundcard name to VIM3L

2020-10-02 Thread Christian Hewitt
VIM3L now inherits the sound node from the VIM3 common dtsi but is
an SM1 device, so label it as such, and stop users blaming future
support issues on the distro/app "wrongly detecting" their device.

Signed-off-by: Christian Hewitt 
---
 arch/arm64/boot/dts/amlogic/meson-sm1-khadas-vim3l.dts | 4 
 1 file changed, 4 insertions(+)

diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1-khadas-vim3l.dts 
b/arch/arm64/boot/dts/amlogic/meson-sm1-khadas-vim3l.dts
index 4b517ca72059..f46f0ecc37ec 100644
--- a/arch/arm64/boot/dts/amlogic/meson-sm1-khadas-vim3l.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-sm1-khadas-vim3l.dts
@@ -32,6 +32,10 @@
regulator-boot-on;
regulator-always-on;
};
+
+   sound {
+   model = "SM1-KHADAS-VIM3L";
+   };
 };
 
  {
-- 
2.17.1



Re: [PATCH 3/3] arm64: dts: meson: add support for the ODROID-N2+

2020-07-21 Thread Christian Hewitt


> On 21 Jul 2020, at 1:14 pm, Jerome Brunet  wrote:
> 
> On Sun 19 Jul 2020 at 16:10, Christian Hewitt  
> wrote:
> 
>> HardKernel ODROID-N2+ uses an Amlogic S922X rev. C chip capable of higher
>> clock speeds than the original ODROID-N2. Hardkernel supports the big cpu
>> cluster at 2.4GHz and the little cpu cluster at 2.0GHz. Opp points and
>> regulator changess are from the HardKernel Linux kernel sources.
>> 
>> Suggested-by: Dongjin Kim 
>> Signed-off-by: Christian Hewitt 
>> ---
>> arch/arm64/boot/dts/amlogic/Makefile  |  1 +
>> .../dts/amlogic/meson-g12b-odroid-n2-plus.dts | 53 +++
>> 2 files changed, 54 insertions(+)
>> create mode 100644 arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2-plus.dts
>> 
>> diff --git a/arch/arm64/boot/dts/amlogic/Makefile 
>> b/arch/arm64/boot/dts/amlogic/Makefile
>> index 5cac4d1d487d..6dc508b80133 100644
>> --- a/arch/arm64/boot/dts/amlogic/Makefile
>> +++ b/arch/arm64/boot/dts/amlogic/Makefile
>> @@ -8,6 +8,7 @@ dtb-$(CONFIG_ARCH_MESON) += meson-g12b-gtking-pro.dtb
>> dtb-$(CONFIG_ARCH_MESON) += meson-g12b-a311d-khadas-vim3.dtb
>> dtb-$(CONFIG_ARCH_MESON) += meson-g12b-s922x-khadas-vim3.dtb
>> dtb-$(CONFIG_ARCH_MESON) += meson-g12b-odroid-n2.dtb
>> +dtb-$(CONFIG_ARCH_MESON) += meson-g12b-odroid-n2-plus.dtb
>> dtb-$(CONFIG_ARCH_MESON) += meson-g12b-ugoos-am6.dtb
>> dtb-$(CONFIG_ARCH_MESON) += meson-gxbb-kii-pro.dtb
>> dtb-$(CONFIG_ARCH_MESON) += meson-gxbb-nanopi-k2.dtb
>> diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2-plus.dts 
>> b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2-plus.dts
>> new file mode 100644
>> index ..99e96be509f8
>> --- /dev/null
>> +++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2-plus.dts
>> @@ -0,0 +1,53 @@
>> +// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
>> +/*
>> + * Copyright (c) 2019 BayLibre, SAS
>> + * Author: Neil Armstrong 
>> + */
>> +
>> +/dts-v1/;
>> +
>> +#include "meson-g12b-odroid-n2.dtsi"
>> +
>> +/ {
>> +compatible = "hardkernel,odroid-n2-plus", "amlogic,s922x", 
>> "amlogic,g12b";
>> +model = "Hardkernel ODROID-N2+";
>> +
>> +vddcpu_a: regulator-vddcpu-a {
>> +regulator-min-microvolt = <68>;
>> +regulator-max-microvolt = <104>;
>> +
>> +pwms = <_ab 0 1500 0>;
>> +};
>> +
>> +vddcpu_b: regulator-vddcpu-b {
>> +regulator-min-microvolt = <68>;
>> +regulator-max-microvolt = <104>;
>> +
>> +pwms = <_AO_cd 1 1500 0>;
>> +};
>> +
>> +cpu_opp_table_0: opp-table-0 {
>> +opp-190800 {
>> +opp-hz = /bits/ 64 <190800>;
>> +opp-microvolt = <103>;
>> +};
>> +
>> +opp-201600 {
>> +opp-hz = /bits/ 64 <201600>;
>> +opp-microvolt = <104>;
>> +};
>> +};
>> +
>> +cpub_opp_table_1: opp-table-1 {
>> +opp-230400 {
>> +opp-hz = /bits/ 64 <230400>;
>> +opp-microvolt = <103>;
>> +};
>> +
>> +opp-24 {
>> +opp-hz = /bits/ 64 <24>;
>> +opp-microvolt = <104>;
>> +};
>> +};
> 
> Are this opp specific to the N2+ or S922x rev C ?
> If it is the latter, shouldn't these be in s922x-revC dtsi ?

N2+ is currently the only known device with RevC chip (and shipping with
a huge heatsink) so we don’t know. I prefer to to put them in the board
dts for now and move to a common dtsi in the future once we’ve seen more
devices in the wild and proven they can handle the overclock.

Christian



Re: [PATCH 3/3] arm64: dts: meson: add support for the ODROID-N2+

2020-07-21 Thread Christian Hewitt


> On 21 Jul 2020, at 12:19 pm, Neil Armstrong  wrote:
> 
> On 21/07/2020 10:10, Neil Armstrong wrote:
>> On 19/07/2020 16:10, Christian Hewitt wrote:
>>> HardKernel ODROID-N2+ uses an Amlogic S922X rev. C chip capable of higher
>>> clock speeds than the original ODROID-N2. Hardkernel supports the big cpu
>>> cluster at 2.4GHz and the little cpu cluster at 2.0GHz. Opp points and
>>> regulator changess are from the HardKernel Linux kernel sources.
>>> 
>>> Suggested-by: Dongjin Kim 
>>> Signed-off-by: Christian Hewitt 
>>> ---
>>> arch/arm64/boot/dts/amlogic/Makefile  |  1 +
>>> .../dts/amlogic/meson-g12b-odroid-n2-plus.dts | 53 +++
>>> 2 files changed, 54 insertions(+)
>>> create mode 100644 arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2-plus.dts
>>> 
>>> diff --git a/arch/arm64/boot/dts/amlogic/Makefile 
>>> b/arch/arm64/boot/dts/amlogic/Makefile
>>> index 5cac4d1d487d..6dc508b80133 100644
>>> --- a/arch/arm64/boot/dts/amlogic/Makefile
>>> +++ b/arch/arm64/boot/dts/amlogic/Makefile
>>> @@ -8,6 +8,7 @@ dtb-$(CONFIG_ARCH_MESON) += meson-g12b-gtking-pro.dtb
>>> dtb-$(CONFIG_ARCH_MESON) += meson-g12b-a311d-khadas-vim3.dtb
>>> dtb-$(CONFIG_ARCH_MESON) += meson-g12b-s922x-khadas-vim3.dtb
>>> dtb-$(CONFIG_ARCH_MESON) += meson-g12b-odroid-n2.dtb
>>> +dtb-$(CONFIG_ARCH_MESON) += meson-g12b-odroid-n2-plus.dtb
>>> dtb-$(CONFIG_ARCH_MESON) += meson-g12b-ugoos-am6.dtb
>>> dtb-$(CONFIG_ARCH_MESON) += meson-gxbb-kii-pro.dtb
>>> dtb-$(CONFIG_ARCH_MESON) += meson-gxbb-nanopi-k2.dtb
>>> diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2-plus.dts 
>>> b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2-plus.dts
>>> new file mode 100644
>>> index ..99e96be509f8
>>> --- /dev/null
>>> +++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2-plus.dts
>>> @@ -0,0 +1,53 @@
>>> +// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
>>> +/*
>>> + * Copyright (c) 2019 BayLibre, SAS
>>> + * Author: Neil Armstrong 
>>> + */
>>> +
>>> +/dts-v1/;
>>> +
>>> +#include "meson-g12b-odroid-n2.dtsi"
>>> +
>>> +/ {
>>> +   compatible = "hardkernel,odroid-n2-plus", "amlogic,s922x", 
>>> "amlogic,g12b";
>>> +   model = "Hardkernel ODROID-N2+";
>>> +
>>> +   vddcpu_a: regulator-vddcpu-a {
>>> +   regulator-min-microvolt = <68>;
>>> +   regulator-max-microvolt = <104>;
>>> +
>>> +   pwms = <_ab 0 1500 0>;
>>> +   };
>>> +
>>> +   vddcpu_b: regulator-vddcpu-b {
>>> +   regulator-min-microvolt = <68>;
>>> +   regulator-max-microvolt = <104>;
>>> +
>>> +   pwms = <_AO_cd 1 1500 0>;
>>> +   };
>>> +
>>> +   cpu_opp_table_0: opp-table-0 {
>>> +   opp-190800 {
>>> +   opp-hz = /bits/ 64 <190800>;
>>> +   opp-microvolt = <103>;
>>> +   };
>>> +
>>> +   opp-201600 {
>>> +   opp-hz = /bits/ 64 <201600>;
>>> +   opp-microvolt = <104>;
>>> +   };
>>> +   };
>>> +
>>> +   cpub_opp_table_1: opp-table-1 {
>>> +   opp-230400 {
>>> +   opp-hz = /bits/ 64 <230400>;
>>> +   opp-microvolt = <103>;
>>> +   };
>>> +
>>> +   opp-24 {
>>> +   opp-hz = /bits/ 64 <24>;
>>> +   opp-microvolt = <104>;
>>> +   };
>>> +   };
>>> +};
>>> +
>>> 
>> Reviewed-by: Neil Armstrong 
>> 
> 
> Wait no, it should be:
> 
> / {
>   compatible = "hardkernel,odroid-n2-plus", "amlogic,s922x", 
> "amlogic,g12b";
>   model = "Hardkernel ODROID-N2+";
> };
> 
> _a {
>   regulator-min-microvolt = <68>;
>   regulator-max-microvolt = <104>;
> 
>   pwms = <_ab 0 1500 0>;
> };
> 
> _b {
>   regulator-min-microvolt = <68>;
>   regulator-max-microvolt = <104>;
> 
>   pwms = <_AO_cd 1 1500 0>;
> };
> 
> _opp_table_0 {
>   opp-190800 {
>   opp-hz = /bits/ 64 <190800>;
>   opp-microvolt = <103>;
>   };
> 
>   opp-201600 {
>   opp-hz = /bits/ 64 <201600>;
>   opp-microvolt = <104>;
>   };
> };
> 
> _opp_table_1 {
>   opp-230400 {
>   opp-hz = /bits/ 64 <230400>;
>   opp-microvolt = <103>;
>   };
> 
>   opp-24 {
>   opp-hz = /bits/ 64 <24>;
>   opp-microvolt = <104>;
>   };
> };
> 
> Neil

Okay, I will send corrected v2 and with model name changed.

Christian

  1   2   3   >