Skip to contentSkip to conversation

arm64: dts: qcom: apq8016: Add Schneider HMIBSC board DTS

PATCH Superseded Sumit Garg 4 participants 12 messages Mar 15, 2024 – Mar 22, 2024

Subsystems (3)

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Sumit Garg

author
#0 lore raw

v3 cover arm64: dts: qcom: apq8016: Add Schneider HMIBSC board DTS

Add Schneider Electric HMIBSC board DTS. The HMIBSC board is an IIoT Edge Box Core board based on the Qualcomm APQ8016E SoC. For more information refer to the product page [1].

One of the major difference from db410c is serial port where HMIBSC board uses UART1 as the debug console with a default RS232 mode (UART1 mode mux configured via gpio99 and gpio100).

Support for Schneider Electric HMIBSC. Features:
- Qualcomm Snapdragon 410C SoC - APQ8016 (4xCortex A53, Adreno 306)
- 1GiB RAM
- 8GiB eMMC, SD slot
- WiFi and Bluetooth
- 2x Host, 1x Device USB port
- HDMI
- Discrete TPM2 chip over SPI
- USB ethernet adaptors (soldered)

This series is a v2 since v1 of this DTS file has been reviewed on the U-Boot mailing list [2].

Changes in v3:
- Picked up tags.
- Fixed further DT schema warnings.
- Configure resin/power button interrupt as falling edge.
- Incorporate DTS coding style comments from Krzysztof and Konrad.

Changes in v2:
- Fix DT schema warnings.
- Incorporate suggestions from Stephan.
- Document UART1 mode GPIOs based mux.

[1] https://www.se.com/us/en/product/HMIBSCEA53D1L0T/iiot-edge-box-core-harmony-ipc-emmc-dc-linux-tpm/
[2] https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

Sumit Garg (3):
dt-bindings: vendor-prefixes: Add Schneider Electric
dt-bindings: arm: qcom: Add Schneider Electric HMIBSC board
arm64: dts: qcom: apq8016: Add Schneider HMIBSC board DTS

 .../devicetree/bindings/arm/qcom.yaml         |   1 +
 .../devicetree/bindings/vendor-prefixes.yaml  |   2 +
 arch/arm64/boot/dts/qcom/Makefile             |   1 +
 .../dts/qcom/apq8016-schneider-hmibsc.dts     | 510 ++++++++++++++++++
 4 files changed, 514 insertions(+)
 create mode 100644 arch/arm64/boot/dts/qcom/apq8016-schneider-hmibsc.dts
Signature · 1 line
2.34.1
author
#1 lore raw

PATCH v3 1/3 dt-bindings: vendor-prefixes: Add Schneider Electric

Add vendor prefix for Schneider Electric (https://www.se.com/).

---
 Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/vendor-prefixes.yaml +2 -0
index 1a0dc04f1db4..4ef38573e411 100644
@@ -1211,6 +1211,8 @@ patternProperties:
     description: Smart Battery System
   "^schindler,.*":
     description: Schindler
+  "^schneider,.*":
+    description: Schneider Electric
   "^seagate,.*":
     description: Seagate Technology PLC
   "^seeed,.*":
Signature · 1 line
2.34.1
author
#2 lore raw

PATCH v3 2/3 dt-bindings: arm: qcom: Add Schneider Electric HMIBSC board

In reply to Sumit Garg

Document the compatible for the Schneider Electric HMIBSC IIoT edge box core board based on the Qualcomm APQ8016E SoC.

---
 Documentation/devicetree/bindings/arm/qcom.yaml | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/arm/qcom.yaml +1 -0
index 1a5fb889a444..c8c91754fe04 100644
@@ -137,6 +137,7 @@ properties:
       - items:
           - enum:
               - qcom,apq8016-sbc
+              - schneider,apq8016-hmibsc
           - const: qcom,apq8016
 
       - items:
Signature · 1 line
2.34.1
author
#3 lore raw

PATCH v3 3/3 arm64: dts: qcom: apq8016: Add Schneider HMIBSC board DTS

In reply to Sumit Garg

Add Schneider Electric HMIBSC board DTS. The HMIBSC board is an IIoT Edge Box Core board based on the Qualcomm APQ8016E SoC.

Support for Schneider Electric HMIBSC. Features:
- Qualcomm Snapdragon 410C SoC - APQ8016 (4xCortex A53, Adreno 306)
- 1GiB RAM
- 8GiB eMMC, SD slot
- WiFi and Bluetooth
- 2x Host, 1x Device USB port
- HDMI
- Discrete TPM2 chip over SPI
- USB ethernet adaptors (soldered)

---
 arch/arm64/boot/dts/qcom/Makefile             |   1 +
 .../dts/qcom/apq8016-schneider-hmibsc.dts     | 510 ++++++++++++++++++
 2 files changed, 511 insertions(+)
 create mode 100644 arch/arm64/boot/dts/qcom/apq8016-schneider-hmibsc.dts
arch/arm64/boot/dts/qcom/Makefile +1 -0
index 39889d5f8e12..ad55e52e950b 100644
@@ -5,6 +5,7 @@ apq8016-sbc-usb-host-dtbs	:= apq8016-sbc.dtb apq8016-sbc-usb-host.dtbo
 
 dtb-$(CONFIG_ARCH_QCOM)	+= apq8016-sbc-usb-host.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= apq8016-sbc-d3-camera-mezzanine.dtb
+dtb-$(CONFIG_ARCH_QCOM)	+= apq8016-schneider-hmibsc.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= apq8039-t2.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= apq8094-sony-xperia-kitakami-karin_windy.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= apq8096-db820c.dtb
arch/arm64/boot/dts/qcom/apq8016-schneider-hmibsc.dts new file +510 -0

510 lines not on this page · raw message

Signature · 1 line
2.34.1
#4 lore raw
Quoted 64 lines · Sumit Garg

Add Schneider Electric HMIBSC board DTS. The HMIBSC board is an IIoT Edge Box Core board based on the Qualcomm APQ8016E SoC.

Support for Schneider Electric HMIBSC. Features:
- Qualcomm Snapdragon 410C SoC - APQ8016 (4xCortex A53, Adreno 306)
- 1GiB RAM
- 8GiB eMMC, SD slot
- WiFi and Bluetooth
- 2x Host, 1x Device USB port
- HDMI
- Discrete TPM2 chip over SPI
- USB ethernet adaptors (soldered)

---
 arch/arm64/boot/dts/qcom/Makefile             |   1 +
 .../dts/qcom/apq8016-schneider-hmibsc.dts     | 510 ++++++++++++++++++
 2 files changed, 511 insertions(+)
 create mode 100644 arch/arm64/boot/dts/qcom/apq8016-schneider-hmibsc.dts
arch/arm64/boot/dts/qcom/Makefile +1 -0
index 39889d5f8e12..ad55e52e950b 100644
@@ -5,6 +5,7 @@ apq8016-sbc-usb-host-dtbs	:= apq8016-sbc.dtb apq8016-sbc-usb-host.dtbo
 
 dtb-$(CONFIG_ARCH_QCOM)	+= apq8016-sbc-usb-host.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= apq8016-sbc-d3-camera-mezzanine.dtb
+dtb-$(CONFIG_ARCH_QCOM)	+= apq8016-schneider-hmibsc.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= apq8039-t2.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= apq8094-sony-xperia-kitakami-karin_windy.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= apq8096-db820c.dtb
arch/arm64/boot/dts/qcom/apq8016-schneider-hmibsc.dts new file +22 -0
new file mode 100644
index 000000000000..9c79a31a04db
@@ -0,0 +1,510 @@
[...]
+&blsp_uart1 {
+	label = "UART0";
+	status = "okay";
+};
+
+&blsp_uart2 {
+	label = "UART1";
+	status = "okay";
+};
+
+/* Enable CoreSight */
+&cti0 { status = "okay"; };
+&cti1 { status = "okay"; };
+&cti12 { status = "okay"; };
+&cti13 { status = "okay"; };
+&cti14 { status = "okay"; };
+&cti15 { status = "okay"; };
+&debug0 { status = "okay"; };
+&debug1 { status = "okay"; };
+&debug2 { status = "okay"; };
+&debug3 { status = "okay"; };
+&etf { status = "okay"; };

arch/arm64/boot/dts/qcom/apq8016-schneider-hmibsc.dts line 227

Quoted 10 lines
arch/arm64/boot/dts/qcom/apq8016-schneider-hmibsc.dts new file +10 -0
+&etm0 { status = "okay"; };
+&etm1 { status = "okay"; };
+&etm2 { status = "okay"; };
+&etm3 { status = "okay"; };
+&etr { status = "okay"; };
+&funnel0 { status = "okay"; };
+&funnel1 { status = "okay"; };
+&replicator { status = "okay"; };
+&stm { status = "okay"; };
+&tpiu { status = "okay"; };

Nitpick: The &cti0 is in the correct alphabetically ordered place, but &replicator, &stm and &tpiu are not.

I know you changed this based on the review comments but I personally think it was clearer having this separated as condensed block towards the end of the file (where it was before).

The other option would be to put each element individually at the correctly ordered position in the file. However, having a single "Enable CoreSight" comment for the entire block would then not work anymore since all the lines would be interspersed throughout the file.

Quoted 55 lines

[...]
+&pm8916_codec {

arch/arm64/boot/dts/qcom/apq8016-schneider-hmibsc.dts new file +53 -0
+	qcom,mbhc-vthreshold-low = <75 150 237 450 500>;
+	qcom,mbhc-vthreshold-high = <75 150 237 450 500>;
+	status = "okay";
+};
+
+&pm8916_gpios {
+	gpio-line-names =
+		"USB_HUB_RESET_N_PM",
+		"USB_SW_SEL_PM",
+		"NC",
+		"NC";
+
+	usb_hub_reset_pm: usb-hub-reset-pm-state {
+		pins = "gpio1";
+		function = PMIC_GPIO_FUNC_NORMAL;
+
+		input-disable;
+		output-high;
+	};
+
+	usb_hub_reset_pm_device: usb-hub-reset-pm-device-state {
+		pins = "gpio1";
+		function = PMIC_GPIO_FUNC_NORMAL;
+
+		output-low;
+	};
+
+	usb_sw_sel_pm: usb-sw-sel-pm-state {
+		pins = "gpio2";
+		function = PMIC_GPIO_FUNC_NORMAL;
+
+		power-source = <PM8916_GPIO_VPH>;
+		input-disable;
+		output-high;
+	};
+
+	usb_sw_sel_pm_device: usb-sw-sel-pm-device-state {
+		pins = "gpio2";
+		function = PMIC_GPIO_FUNC_NORMAL;
+
+		power-source = <PM8916_GPIO_VPH>;
+		input-disable;
+		output-low;
+	};
+};
+
+&pm8916_mpps {
+	gpio-line-names =
+		"NC",
+		"WLAN_LED_CTRL",
+		"BT_LED_CTRL",
+		"NC";
+

arch/arm64/boot/dts/qcom/apq8016-schneider-hmibsc.dts line 305

Quoted 10 lines
arch/arm64/boot/dts/qcom/apq8016-schneider-hmibsc.dts new file +10 -0
+	pm8916_mpps_leds: pm8916-mpps-state {
+		pins = "mpp2", "mpp3";
+		function = "digital";
+
+		output-low;
+	};
+};
+
+&pm8916_resin {
+	interrupts = <0x0 0x8 1 IRQ_TYPE_EDGE_FALLING>;

What is the goal of overriding the interrupt here? It looks like you are changing the interrupt type from IRQ_TYPE_EDGE_BOTH to FALLING. This sounds a bit like you want the driver to receive just button release events (or just press events, not sure about the polarity). I'm not sure if the driver will handle this correctly.

Quoted 105 lines
arch/arm64/boot/dts/qcom/apq8016-schneider-hmibsc.dts new file +105 -0
+	linux,code = <KEY_POWER>;
+	status = "okay";
+};
+
+&pm8916_rpm_regulators {
+	pm8916_l17: l17 {
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+	};
+};
+
+&sdhc_1 {
+	status = "okay";
+};
+
+&sdhc_2 {
+	pinctrl-0 = <&sdc2_default &sdc2_cd_default>;
+	pinctrl-1 = <&sdc2_sleep &sdc2_cd_default>;
+	pinctrl-names = "default", "sleep";
+
+	cd-gpios = <&tlmm 38 GPIO_ACTIVE_LOW>;
+	status = "okay";
+};
+
+&sound {
+	pinctrl-0 = <&cdc_pdm_default &sec_mi2s_default>;
+	pinctrl-1 = <&cdc_pdm_sleep &sec_mi2s_sleep>;
+	pinctrl-names = "default", "sleep";
+	model = "HMIBSC";
+	audio-routing =
+		"AMIC2", "MIC BIAS Internal2",
+		"AMIC3", "MIC BIAS External1";
+	status = "okay";
+
+	quaternary-dai-link {
+		link-name = "ADV7533";
+		cpu {
+			sound-dai = <&lpass MI2S_QUATERNARY>;
+		};
+		codec {
+			sound-dai = <&adv_bridge 0>;
+		};
+	};
+
+	primary-dai-link {
+		link-name = "WCD";
+		cpu {
+			sound-dai = <&lpass MI2S_PRIMARY>;
+		};
+		codec {
+			sound-dai = <&lpass_codec 0>, <&pm8916_codec 0>;
+		};
+	};
+
+	tertiary-dai-link {
+		link-name = "WCD-Capture";
+		cpu {
+			sound-dai = <&lpass MI2S_TERTIARY>;
+		};
+		codec {
+			sound-dai = <&lpass_codec 1>, <&pm8916_codec 1>;
+		};
+	};
+};
+
+&tlmm {
+	pinctrl-0 = <&uart1_mux0_rs232_high &uart1_mux1_rs232_low>;
+	pinctrl-names = "default";
+
+	adv7533_int_active: adv533-int-active-state {
+		pins = "gpio31";
+		function = "gpio";
+
+		drive-strength = <16>;
+		bias-disable;
+	};
+
+	adv7533_int_suspend: adv7533-int-suspend-state {
+		pins = "gpio31";
+		function = "gpio";
+
+		drive-strength = <2>;
+		bias-disable;
+	};
+
+	adv7533_switch_active: adv7533-switch-active-state {
+		pins = "gpio32";
+		function = "gpio";
+
+		drive-strength = <16>;
+		bias-disable;
+	};
+
+	adv7533_switch_suspend: adv7533-switch-suspend-state {
+		pins = "gpio32";
+		function = "gpio";
+
+		drive-strength = <2>;
+		bias-disable;
+	};
+
+	msm_key_volp_n_default: msm-key-volp-n-default-state {
+		pins = "gpio107";
+		function = "gpio";
+

arch/arm64/boot/dts/qcom/apq8016-schneider-hmibsc.dts line 420

Quoted 10 lines
arch/arm64/boot/dts/qcom/apq8016-schneider-hmibsc.dts new file +10 -0
+		drive-strength = <8>;
+		bias-pull-up;
+	};
+
+	sdc2_cd_default: sdc2-cd-default-state {
+		pins = "gpio38";
+		function = "gpio";
+		drive-strength = <2>;
+		bias-disable;
+	};

Nitpick: It would look a bit cleaner to have the empty lines consistent in all pinctrl nodes, i.e. either always having an empty line between function and drive-strength or never. I think Konrad prefers the more compact version without empty line (sadly I'm not sure if this is clearly documented anywhere). Same for &pm8916_gpios and mpps.

Quoted 4 lines
arch/arm64/boot/dts/qcom/apq8016-schneider-hmibsc.dts new file +4 -0
+
+	/*
+	 * UART1 being the debug console supports various modes of
+	 * operation (RS-232/485/422) controlled via GPIOs configured

arch/arm64/boot/dts/qcom/apq8016-schneider-hmibsc.dts line 434

Quoted 10 lines
arch/arm64/boot/dts/qcom/apq8016-schneider-hmibsc.dts new file +10 -0
+	 * mux as follows:
+	 *
+	 *   gpio100    gpio99    UART mode
+	 *   0          0         loopback
+	 *   0          1         RS-232
+	 *   1          0         RS-485
+	 *   1          1         RS-422
+	 *
+	 * The default mode configured here is RS-232 mode.
+	 */

:D

Thanks a lot for making this clear using the table. And also for all the other cleanup changes!

Stephan

author
#5 lore raw
Quoted 80 lines · Stephan Gerhold
Quoted 64 lines · Sumit Garg

Add Schneider Electric HMIBSC board DTS. The HMIBSC board is an IIoT Edge Box Core board based on the Qualcomm APQ8016E SoC.

Support for Schneider Electric HMIBSC. Features:
- Qualcomm Snapdragon 410C SoC - APQ8016 (4xCortex A53, Adreno 306)
- 1GiB RAM
- 8GiB eMMC, SD slot
- WiFi and Bluetooth
- 2x Host, 1x Device USB port
- HDMI
- Discrete TPM2 chip over SPI
- USB ethernet adaptors (soldered)

---
 arch/arm64/boot/dts/qcom/Makefile             |   1 +
 .../dts/qcom/apq8016-schneider-hmibsc.dts     | 510 ++++++++++++++++++
 2 files changed, 511 insertions(+)
 create mode 100644 arch/arm64/boot/dts/qcom/apq8016-schneider-hmibsc.dts
arch/arm64/boot/dts/qcom/Makefile +1 -0
index 39889d5f8e12..ad55e52e950b 100644
@@ -5,6 +5,7 @@ apq8016-sbc-usb-host-dtbs     := apq8016-sbc.dtb apq8016-sbc-usb-host.dtbo
 
 dtb-$(CONFIG_ARCH_QCOM)      += apq8016-sbc-usb-host.dtb
 dtb-$(CONFIG_ARCH_QCOM)      += apq8016-sbc-d3-camera-mezzanine.dtb
+dtb-$(CONFIG_ARCH_QCOM)      += apq8016-schneider-hmibsc.dtb
 dtb-$(CONFIG_ARCH_QCOM)      += apq8039-t2.dtb
 dtb-$(CONFIG_ARCH_QCOM)      += apq8094-sony-xperia-kitakami-karin_windy.dtb
 dtb-$(CONFIG_ARCH_QCOM)      += apq8096-db820c.dtb
arch/arm64/boot/dts/qcom/apq8016-schneider-hmibsc.dts new file +22 -0
new file mode 100644
index 000000000000..9c79a31a04db
@@ -0,0 +1,510 @@
[...]
+&blsp_uart1 {
+     label = "UART0";
+     status = "okay";
+};
+
+&blsp_uart2 {
+     label = "UART1";
+     status = "okay";
+};
+
+/* Enable CoreSight */
+&cti0 { status = "okay"; };
+&cti1 { status = "okay"; };
+&cti12 { status = "okay"; };
+&cti13 { status = "okay"; };
+&cti14 { status = "okay"; };
+&cti15 { status = "okay"; };
+&debug0 { status = "okay"; };
+&debug1 { status = "okay"; };
+&debug2 { status = "okay"; };
+&debug3 { status = "okay"; };
+&etf { status = "okay"; };

arch/arm64/boot/dts/qcom/apq8016-schneider-hmibsc.dts line 227

Quoted 10 lines
arch/arm64/boot/dts/qcom/apq8016-schneider-hmibsc.dts new file +10 -0
+&etm0 { status = "okay"; };
+&etm1 { status = "okay"; };
+&etm2 { status = "okay"; };
+&etm3 { status = "okay"; };
+&etr { status = "okay"; };
+&funnel0 { status = "okay"; };
+&funnel1 { status = "okay"; };
+&replicator { status = "okay"; };
+&stm { status = "okay"; };
+&tpiu { status = "okay"; };

Nitpick: The &cti0 is in the correct alphabetically ordered place, but &replicator, &stm and &tpiu are not.

Quoted 8 lines

I know you changed this based on the review comments but I personally think it was clearer having this separated as condensed block towards the end of the file (where it was before).

The other option would be to put each element individually at the correctly ordered position in the file. However, having a single "Enable CoreSight" comment for the entire block would then not work anymore since all the lines would be interspersed throughout the file.

IMO, having it as a condensed block is a bit more clear such that people are able to locate overrides easily given their function. However, there aren't any guidelines for such block orders. So let me wait to hear back from platform maintainers if they would like anything to be changed here.

Quoted 64 lines
Quoted 64 lines

[...]
+&pm8916_codec {

arch/arm64/boot/dts/qcom/apq8016-schneider-hmibsc.dts new file +61 -0
+     qcom,mbhc-vthreshold-low = <75 150 237 450 500>;
+     qcom,mbhc-vthreshold-high = <75 150 237 450 500>;
+     status = "okay";
+};
+
+&pm8916_gpios {
+     gpio-line-names =
+             "USB_HUB_RESET_N_PM",
+             "USB_SW_SEL_PM",
+             "NC",
+             "NC";
+
+     usb_hub_reset_pm: usb-hub-reset-pm-state {
+             pins = "gpio1";
+             function = PMIC_GPIO_FUNC_NORMAL;
+
+             input-disable;
+             output-high;
+     };
+
+     usb_hub_reset_pm_device: usb-hub-reset-pm-device-state {
+             pins = "gpio1";
+             function = PMIC_GPIO_FUNC_NORMAL;
+
+             output-low;
+     };
+
+     usb_sw_sel_pm: usb-sw-sel-pm-state {
+             pins = "gpio2";
+             function = PMIC_GPIO_FUNC_NORMAL;
+
+             power-source = <PM8916_GPIO_VPH>;
+             input-disable;
+             output-high;
+     };
+
+     usb_sw_sel_pm_device: usb-sw-sel-pm-device-state {
+             pins = "gpio2";
+             function = PMIC_GPIO_FUNC_NORMAL;
+
+             power-source = <PM8916_GPIO_VPH>;
+             input-disable;
+             output-low;
+     };
+};
+
+&pm8916_mpps {
+     gpio-line-names =
+             "NC",
+             "WLAN_LED_CTRL",
+             "BT_LED_CTRL",
+             "NC";
+
+     pm8916_mpps_leds: pm8916-mpps-state {
+             pins = "mpp2", "mpp3";
+             function = "digital";
+
+             output-low;
+     };
+};
+
Quoted 8 lines
Quoted 2 lines

+&pm8916_resin {
+ interrupts = <0x0 0x8 1 IRQ_TYPE_EDGE_FALLING>;

What is the goal of overriding the interrupt here? It looks like you are changing the interrupt type from IRQ_TYPE_EDGE_BOTH to FALLING. This sounds a bit like you want the driver to receive just button release events (or just press events, not sure about the polarity). I'm not sure if the driver will handle this correctly.

The use-case here is to just act upon button release events and the driver handles this appropriately. Final use-case of the reset button:

- Short press and release leads to normal Linux reboot.
- Long press for more than 10 sec or so leads to a hard reset.

With IRQ_TYPE_EDGE_BOTH, that's not achievable because just a simple press leads to Linux reboot.

Quoted 114 lines
Quoted 114 lines
arch/arm64/boot/dts/qcom/apq8016-schneider-hmibsc.dts new file +113 -0
+     linux,code = <KEY_POWER>;
+     status = "okay";
+};
+
+&pm8916_rpm_regulators {
+     pm8916_l17: l17 {
+             regulator-min-microvolt = <3300000>;
+             regulator-max-microvolt = <3300000>;
+     };
+};
+
+&sdhc_1 {
+     status = "okay";
+};
+
+&sdhc_2 {
+     pinctrl-0 = <&sdc2_default &sdc2_cd_default>;
+     pinctrl-1 = <&sdc2_sleep &sdc2_cd_default>;
+     pinctrl-names = "default", "sleep";
+
+     cd-gpios = <&tlmm 38 GPIO_ACTIVE_LOW>;
+     status = "okay";
+};
+
+&sound {
+     pinctrl-0 = <&cdc_pdm_default &sec_mi2s_default>;
+     pinctrl-1 = <&cdc_pdm_sleep &sec_mi2s_sleep>;
+     pinctrl-names = "default", "sleep";
+     model = "HMIBSC";
+     audio-routing =
+             "AMIC2", "MIC BIAS Internal2",
+             "AMIC3", "MIC BIAS External1";
+     status = "okay";
+
+     quaternary-dai-link {
+             link-name = "ADV7533";
+             cpu {
+                     sound-dai = <&lpass MI2S_QUATERNARY>;
+             };
+             codec {
+                     sound-dai = <&adv_bridge 0>;
+             };
+     };
+
+     primary-dai-link {
+             link-name = "WCD";
+             cpu {
+                     sound-dai = <&lpass MI2S_PRIMARY>;
+             };
+             codec {
+                     sound-dai = <&lpass_codec 0>, <&pm8916_codec 0>;
+             };
+     };
+
+     tertiary-dai-link {
+             link-name = "WCD-Capture";
+             cpu {
+                     sound-dai = <&lpass MI2S_TERTIARY>;
+             };
+             codec {
+                     sound-dai = <&lpass_codec 1>, <&pm8916_codec 1>;
+             };
+     };
+};
+
+&tlmm {
+     pinctrl-0 = <&uart1_mux0_rs232_high &uart1_mux1_rs232_low>;
+     pinctrl-names = "default";
+
+     adv7533_int_active: adv533-int-active-state {
+             pins = "gpio31";
+             function = "gpio";
+
+             drive-strength = <16>;
+             bias-disable;
+     };
+
+     adv7533_int_suspend: adv7533-int-suspend-state {
+             pins = "gpio31";
+             function = "gpio";
+
+             drive-strength = <2>;
+             bias-disable;
+     };
+
+     adv7533_switch_active: adv7533-switch-active-state {
+             pins = "gpio32";
+             function = "gpio";
+
+             drive-strength = <16>;
+             bias-disable;
+     };
+
+     adv7533_switch_suspend: adv7533-switch-suspend-state {
+             pins = "gpio32";
+             function = "gpio";
+
+             drive-strength = <2>;
+             bias-disable;
+     };
+
+     msm_key_volp_n_default: msm-key-volp-n-default-state {
+             pins = "gpio107";
+             function = "gpio";
+
+             drive-strength = <8>;
+             bias-pull-up;
+     };
+
+     sdc2_cd_default: sdc2-cd-default-state {
+             pins = "gpio38";
+             function = "gpio";
+             drive-strength = <2>;
Quoted 9 lines

arch/arm64/boot/dts/qcom/apq8016-schneider-hmibsc.dts

Quoted 2 lines
arch/arm64/boot/dts/qcom/apq8016-schneider-hmibsc.dts new file +2 -0
+             bias-disable;
+     };

Nitpick: It would look a bit cleaner to have the empty lines consistent in all pinctrl nodes, i.e. either always having an empty line between function and drive-strength or never. I think Konrad prefers the more compact version without empty line (sadly I'm not sure if this is clearly documented anywhere). Same for &pm8916_gpios and mpps.

Sure I can remove the empty lines to be consistent with msm8916.dtsi.

Quoted 15 lines
Quoted 4 lines
arch/arm64/boot/dts/qcom/apq8016-schneider-hmibsc.dts new file +4 -0
+
+     /*
+      * UART1 being the debug console supports various modes of
+      * operation (RS-232/485/422) controlled via GPIOs configured

arch/arm64/boot/dts/qcom/apq8016-schneider-hmibsc.dts line 434

Quoted 10 lines
arch/arm64/boot/dts/qcom/apq8016-schneider-hmibsc.dts new file +10 -0
+      * mux as follows:
+      *
+      *   gpio100    gpio99    UART mode
+      *   0          0         loopback
+      *   0          1         RS-232
+      *   1          0         RS-485
+      *   1          1         RS-422
+      *
+      * The default mode configured here is RS-232 mode.
+      */
Quoted 4 lines

:D

Thanks a lot for making this clear using the table. And also for all the other cleanup changes!

Thanks for your review.

-Sumit

Quoted 2 lines

Stephan

#6 lore raw
Quoted 57 lines · Sumit Garg
Quoted 47 lines · Stephan Gerhold
Quoted 46 lines · Sumit Garg

Add Schneider Electric HMIBSC board DTS. The HMIBSC board is an IIoT Edge Box Core board based on the Qualcomm APQ8016E SoC.

Support for Schneider Electric HMIBSC. Features:
- Qualcomm Snapdragon 410C SoC - APQ8016 (4xCortex A53, Adreno 306)
- 1GiB RAM
- 8GiB eMMC, SD slot
- WiFi and Bluetooth
- 2x Host, 1x Device USB port
- HDMI
- Discrete TPM2 chip over SPI
- USB ethernet adaptors (soldered)

---
 arch/arm64/boot/dts/qcom/Makefile             |   1 +
 .../dts/qcom/apq8016-schneider-hmibsc.dts     | 510 ++++++++++++++++++
 2 files changed, 511 insertions(+)
 create mode 100644 arch/arm64/boot/dts/qcom/apq8016-schneider-hmibsc.dts
arch/arm64/boot/dts/qcom/Makefile +1 -0
index 39889d5f8e12..ad55e52e950b 100644
@@ -5,6 +5,7 @@ apq8016-sbc-usb-host-dtbs     := apq8016-sbc.dtb apq8016-sbc-usb-host.dtbo
 
 dtb-$(CONFIG_ARCH_QCOM)      += apq8016-sbc-usb-host.dtb
 dtb-$(CONFIG_ARCH_QCOM)      += apq8016-sbc-d3-camera-mezzanine.dtb
+dtb-$(CONFIG_ARCH_QCOM)      += apq8016-schneider-hmibsc.dtb
 dtb-$(CONFIG_ARCH_QCOM)      += apq8039-t2.dtb
 dtb-$(CONFIG_ARCH_QCOM)      += apq8094-sony-xperia-kitakami-karin_windy.dtb
 dtb-$(CONFIG_ARCH_QCOM)      += apq8096-db820c.dtb
arch/arm64/boot/dts/qcom/apq8016-schneider-hmibsc.dts new file +4 -0
new file mode 100644
index 000000000000..9c79a31a04db
@@ -0,0 +1,510 @@
[...]
+
+&pm8916_resin {
+     interrupts = <0x0 0x8 1 IRQ_TYPE_EDGE_FALLING>;
+     linux,code = <KEY_POWER>;
Quoted 8 lines

arch/arm64/boot/dts/qcom/apq8016-schneider-hmibsc.dts

Quoted 2 lines
arch/arm64/boot/dts/qcom/apq8016-schneider-hmibsc.dts new file +2 -0
+     status = "okay";
+};

What is the goal of overriding the interrupt here? It looks like you are changing the interrupt type from IRQ_TYPE_EDGE_BOTH to FALLING. This sounds a bit like you want the driver to receive just button release events (or just press events, not sure about the polarity). I'm not sure if the driver will handle this correctly.

Quoted 9 lines

The use-case here is to just act upon button release events and the driver handles this appropriately. Final use-case of the reset button:

- Short press and release leads to normal Linux reboot.
- Long press for more than 10 sec or so leads to a hard reset.

With IRQ_TYPE_EDGE_BOTH, that's not achievable because just a simple press leads to Linux reboot.

Thanks for explaining your use case. Is the DT really the right place to describe this? In the hardware, this is just a button that provides both press and release events. Linux typically forwards these events to user space, without interpreting them in any way. This means you likely have some user space component that listens to the events (e.g. systemd logind). Ideally that component should be reconfigured to trigger the reboot on release instead of press.

If you hardcode this behavior in the DT you are essentially describing that the hardware is incapable of detecting the press event before the release event. This is not the case, right? There may be use cases where someone would still want to detect the key press (rather than just release).

Thanks,
Stephan

author
#7 lore raw
Quoted 69 lines · Stephan Gerhold
Quoted 57 lines · Sumit Garg
Quoted 47 lines · Stephan Gerhold
Quoted 46 lines · Sumit Garg

Add Schneider Electric HMIBSC board DTS. The HMIBSC board is an IIoT Edge Box Core board based on the Qualcomm APQ8016E SoC.

Support for Schneider Electric HMIBSC. Features:
- Qualcomm Snapdragon 410C SoC - APQ8016 (4xCortex A53, Adreno 306)
- 1GiB RAM
- 8GiB eMMC, SD slot
- WiFi and Bluetooth
- 2x Host, 1x Device USB port
- HDMI
- Discrete TPM2 chip over SPI
- USB ethernet adaptors (soldered)

---
 arch/arm64/boot/dts/qcom/Makefile             |   1 +
 .../dts/qcom/apq8016-schneider-hmibsc.dts     | 510 ++++++++++++++++++
 2 files changed, 511 insertions(+)
 create mode 100644 arch/arm64/boot/dts/qcom/apq8016-schneider-hmibsc.dts
arch/arm64/boot/dts/qcom/Makefile +1 -0
index 39889d5f8e12..ad55e52e950b 100644
@@ -5,6 +5,7 @@ apq8016-sbc-usb-host-dtbs     := apq8016-sbc.dtb apq8016-sbc-usb-host.dtbo
 
 dtb-$(CONFIG_ARCH_QCOM)      += apq8016-sbc-usb-host.dtb
 dtb-$(CONFIG_ARCH_QCOM)      += apq8016-sbc-d3-camera-mezzanine.dtb
+dtb-$(CONFIG_ARCH_QCOM)      += apq8016-schneider-hmibsc.dtb
 dtb-$(CONFIG_ARCH_QCOM)      += apq8039-t2.dtb
 dtb-$(CONFIG_ARCH_QCOM)      += apq8094-sony-xperia-kitakami-karin_windy.dtb
 dtb-$(CONFIG_ARCH_QCOM)      += apq8096-db820c.dtb
arch/arm64/boot/dts/qcom/apq8016-schneider-hmibsc.dts new file +4 -0
new file mode 100644
index 000000000000..9c79a31a04db
@@ -0,0 +1,510 @@
[...]
+
+&pm8916_resin {
+     interrupts = <0x0 0x8 1 IRQ_TYPE_EDGE_FALLING>;
+     linux,code = <KEY_POWER>;
Quoted 8 lines

arch/arm64/boot/dts/qcom/apq8016-schneider-hmibsc.dts

Quoted 2 lines
arch/arm64/boot/dts/qcom/apq8016-schneider-hmibsc.dts new file +2 -0
+     status = "okay";
+};

What is the goal of overriding the interrupt here? It looks like you are changing the interrupt type from IRQ_TYPE_EDGE_BOTH to FALLING. This sounds a bit like you want the driver to receive just button release events (or just press events, not sure about the polarity). I'm not sure if the driver will handle this correctly.

Quoted 9 lines

The use-case here is to just act upon button release events and the driver handles this appropriately. Final use-case of the reset button:

- Short press and release leads to normal Linux reboot.
- Long press for more than 10 sec or so leads to a hard reset.

With IRQ_TYPE_EDGE_BOTH, that's not achievable because just a simple press leads to Linux reboot.

Quoted 7 lines

Thanks for explaining your use case. Is the DT really the right place to describe this? In the hardware, this is just a button that provides both press and release events. Linux typically forwards these events to user space, without interpreting them in any way. This means you likely have some user space component that listens to the events (e.g. systemd logind). Ideally that component should be reconfigured to trigger the reboot on release instead of press.

I am not sure if that's really the case. I only see power key value to be reported as follows:

input_report_key(pwrkey->input, pwrkey->code, 1);
or
input_report_key(pwrkey->input, pwrkey->code, 0);

It's not like a press event being a rising edge (0->1) or a release event being a falling edge (1->0) reported. AFAICS, a reboot is issued whenever the value of power key is reported as "1".

Quoted 6 lines

If you hardcode this behavior in the DT you are essentially describing that the hardware is incapable of detecting the press event before the release event. This is not the case, right? There may be use cases where someone would still want to detect the key press (rather than just release).

As of now there isn't such a use-case for the HMIBSC board.

-Sumit

Quoted 3 lines

Thanks,
Stephan

#8 lore raw
Quoted 80 lines · Sumit Garg
Quoted 68 lines · Stephan Gerhold
Quoted 57 lines · Sumit Garg
Quoted 47 lines · Stephan Gerhold
Quoted 46 lines · Sumit Garg

Add Schneider Electric HMIBSC board DTS. The HMIBSC board is an IIoT Edge Box Core board based on the Qualcomm APQ8016E SoC.

Support for Schneider Electric HMIBSC. Features:
- Qualcomm Snapdragon 410C SoC - APQ8016 (4xCortex A53, Adreno 306)
- 1GiB RAM
- 8GiB eMMC, SD slot
- WiFi and Bluetooth
- 2x Host, 1x Device USB port
- HDMI
- Discrete TPM2 chip over SPI
- USB ethernet adaptors (soldered)

---
 arch/arm64/boot/dts/qcom/Makefile             |   1 +
 .../dts/qcom/apq8016-schneider-hmibsc.dts     | 510 ++++++++++++++++++
 2 files changed, 511 insertions(+)
 create mode 100644 arch/arm64/boot/dts/qcom/apq8016-schneider-hmibsc.dts
arch/arm64/boot/dts/qcom/Makefile +1 -0
index 39889d5f8e12..ad55e52e950b 100644
@@ -5,6 +5,7 @@ apq8016-sbc-usb-host-dtbs     := apq8016-sbc.dtb apq8016-sbc-usb-host.dtbo
 
 dtb-$(CONFIG_ARCH_QCOM)      += apq8016-sbc-usb-host.dtb
 dtb-$(CONFIG_ARCH_QCOM)      += apq8016-sbc-d3-camera-mezzanine.dtb
+dtb-$(CONFIG_ARCH_QCOM)      += apq8016-schneider-hmibsc.dtb
 dtb-$(CONFIG_ARCH_QCOM)      += apq8039-t2.dtb
 dtb-$(CONFIG_ARCH_QCOM)      += apq8094-sony-xperia-kitakami-karin_windy.dtb
 dtb-$(CONFIG_ARCH_QCOM)      += apq8096-db820c.dtb
arch/arm64/boot/dts/qcom/apq8016-schneider-hmibsc.dts new file +4 -0
new file mode 100644
index 000000000000..9c79a31a04db
@@ -0,0 +1,510 @@
[...]
+
+&pm8916_resin {
+     interrupts = <0x0 0x8 1 IRQ_TYPE_EDGE_FALLING>;
+     linux,code = <KEY_POWER>;
Quoted 8 lines

arch/arm64/boot/dts/qcom/apq8016-schneider-hmibsc.dts

Quoted 2 lines
arch/arm64/boot/dts/qcom/apq8016-schneider-hmibsc.dts new file +2 -0
+     status = "okay";
+};

What is the goal of overriding the interrupt here? It looks like you are changing the interrupt type from IRQ_TYPE_EDGE_BOTH to FALLING. This sounds a bit like you want the driver to receive just button release events (or just press events, not sure about the polarity). I'm not sure if the driver will handle this correctly.

Quoted 9 lines

The use-case here is to just act upon button release events and the driver handles this appropriately. Final use-case of the reset button:

- Short press and release leads to normal Linux reboot.
- Long press for more than 10 sec or so leads to a hard reset.

With IRQ_TYPE_EDGE_BOTH, that's not achievable because just a simple press leads to Linux reboot.

Quoted 7 lines

Thanks for explaining your use case. Is the DT really the right place to describe this? In the hardware, this is just a button that provides both press and release events. Linux typically forwards these events to user space, without interpreting them in any way. This means you likely have some user space component that listens to the events (e.g. systemd logind). Ideally that component should be reconfigured to trigger the reboot on release instead of press.

I am not sure if that's really the case. I only see power key value to be reported as follows:

Quoted 8 lines

input_report_key(pwrkey->input, pwrkey->code, 1);
or
input_report_key(pwrkey->input, pwrkey->code, 0);

It's not like a press event being a rising edge (0->1) or a release event being a falling edge (1->0) reported. AFAICS, a reboot is issued whenever the value of power key is reported as "1".

If you look inside the input_report_key() function you can see that the input subsystem internally tracks the key state. input_get_disposition() returns INPUT_IGNORE_EVENT if the key bit already has the same value. Only when the key changes its state, an event is sent to user space. This means that all events reported to user space are effectively rising/falling edges (an event with value "1" is a rising edge 0->1, an event with value "0" is a falling edge 1->0).

The only reason why setting IRQ_TYPE_EDGE_FALLING works here is because of the workaround added in commit be8fc023ef64 ("Input: pm8941-pwrkey - simulate missed key press events") [1]. No event is reported when you start pressing the key. When you release the key, you get a key press event (rising edge) immediately followed by a key release (falling edge). But the workaround was added to handle potentially missed interrupts, not to inhibit reporting key press events.

In my opinion, if you want to perform an action on key release rather than key press then you should adjust the user space program to do so. From the point of view of the hardware DT (and even the kernel), the key press happens when you actually start pressing the key, and not later when you release it.

Thanks,
Stephan

[1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=be8fc023ef64dcb11042aaa4bb0f29f7e0335d85

author
#9 lore raw
Quoted 99 lines · Stephan Gerhold
Quoted 80 lines · Sumit Garg
Quoted 68 lines · Stephan Gerhold
Quoted 57 lines · Sumit Garg
Quoted 47 lines · Stephan Gerhold
Quoted 46 lines · Sumit Garg

Add Schneider Electric HMIBSC board DTS. The HMIBSC board is an IIoT Edge Box Core board based on the Qualcomm APQ8016E SoC.

Support for Schneider Electric HMIBSC. Features:
- Qualcomm Snapdragon 410C SoC - APQ8016 (4xCortex A53, Adreno 306)
- 1GiB RAM
- 8GiB eMMC, SD slot
- WiFi and Bluetooth
- 2x Host, 1x Device USB port
- HDMI
- Discrete TPM2 chip over SPI
- USB ethernet adaptors (soldered)

---
 arch/arm64/boot/dts/qcom/Makefile             |   1 +
 .../dts/qcom/apq8016-schneider-hmibsc.dts     | 510 ++++++++++++++++++
 2 files changed, 511 insertions(+)
 create mode 100644 arch/arm64/boot/dts/qcom/apq8016-schneider-hmibsc.dts
arch/arm64/boot/dts/qcom/Makefile +1 -0
index 39889d5f8e12..ad55e52e950b 100644
@@ -5,6 +5,7 @@ apq8016-sbc-usb-host-dtbs     := apq8016-sbc.dtb apq8016-sbc-usb-host.dtbo
 
 dtb-$(CONFIG_ARCH_QCOM)      += apq8016-sbc-usb-host.dtb
 dtb-$(CONFIG_ARCH_QCOM)      += apq8016-sbc-d3-camera-mezzanine.dtb
+dtb-$(CONFIG_ARCH_QCOM)      += apq8016-schneider-hmibsc.dtb
 dtb-$(CONFIG_ARCH_QCOM)      += apq8039-t2.dtb
 dtb-$(CONFIG_ARCH_QCOM)      += apq8094-sony-xperia-kitakami-karin_windy.dtb
 dtb-$(CONFIG_ARCH_QCOM)      += apq8096-db820c.dtb
arch/arm64/boot/dts/qcom/apq8016-schneider-hmibsc.dts new file +4 -0
new file mode 100644
index 000000000000..9c79a31a04db
@@ -0,0 +1,510 @@
[...]
+
+&pm8916_resin {
+     interrupts = <0x0 0x8 1 IRQ_TYPE_EDGE_FALLING>;
+     linux,code = <KEY_POWER>;
Quoted 8 lines

arch/arm64/boot/dts/qcom/apq8016-schneider-hmibsc.dts

Quoted 2 lines
arch/arm64/boot/dts/qcom/apq8016-schneider-hmibsc.dts new file +2 -0
+     status = "okay";
+};

What is the goal of overriding the interrupt here? It looks like you are changing the interrupt type from IRQ_TYPE_EDGE_BOTH to FALLING. This sounds a bit like you want the driver to receive just button release events (or just press events, not sure about the polarity). I'm not sure if the driver will handle this correctly.

Quoted 9 lines

The use-case here is to just act upon button release events and the driver handles this appropriately. Final use-case of the reset button:

- Short press and release leads to normal Linux reboot.
- Long press for more than 10 sec or so leads to a hard reset.

With IRQ_TYPE_EDGE_BOTH, that's not achievable because just a simple press leads to Linux reboot.

Quoted 7 lines

Thanks for explaining your use case. Is the DT really the right place to describe this? In the hardware, this is just a button that provides both press and release events. Linux typically forwards these events to user space, without interpreting them in any way. This means you likely have some user space component that listens to the events (e.g. systemd logind). Ideally that component should be reconfigured to trigger the reboot on release instead of press.

I am not sure if that's really the case. I only see power key value to be reported as follows:

Quoted 8 lines

input_report_key(pwrkey->input, pwrkey->code, 1);
or
input_report_key(pwrkey->input, pwrkey->code, 0);

It's not like a press event being a rising edge (0->1) or a release event being a falling edge (1->0) reported. AFAICS, a reboot is issued whenever the value of power key is reported as "1".

If you look inside the input_report_key() function you can see that the input subsystem internally tracks the key state. input_get_disposition() returns INPUT_IGNORE_EVENT if the key bit already has the same value. Only when the key changes its state, an event is sent to user space. This means that all events reported to user space are effectively rising/falling edges (an event with value "1" is a rising edge 0->1, an event with value "0" is a falling edge 1->0).

Quoted 7 lines

The only reason why setting IRQ_TYPE_EDGE_FALLING works here is because of the workaround added in commit be8fc023ef64 ("Input: pm8941-pwrkey - simulate missed key press events") [1]. No event is reported when you start pressing the key. When you release the key, you get a key press event (rising edge) immediately followed by a key release (falling edge). But the workaround was added to handle potentially missed interrupts, not to inhibit reporting key press events.

I rather see it differently being actually allowing the current use-case to support only the IRQ_TYPE_EDGE_FALLING. As per your description above, a falling edge can only be an event for user-space if we have:

input_report_key(pwrkey->input, pwrkey->code, 1);
input_report_key(pwrkey->input, pwrkey->code, 0);

rather than only

input_report_key(pwrkey->input, pwrkey->code, 0);

which won't trigger any event for user-space, right?

Quoted 6 lines

In my opinion, if you want to perform an action on key release rather than key press then you should adjust the user space program to do so. From the point of view of the hardware DT (and even the kernel), the key press happens when you actually start pressing the key, and not later when you release it.

The reason why we are discussing it back and forth looks like due to lack of clarity as to how HMIBSC board supports this button. The common implementation as per db410c DTS is to have two buttons:

- One button is representing pwrkey(KEY_POWER) which is solely consumed by the operating system to cleanly power off/restart the db410c.
- Another button is representing pm8916_resin(KEY_VOLUMEDOWN) which apart from normal volume down is also consumed by PMIC hardware to perform a hard reset on a long press (if more than 10 sec.).

However, on HMIBSC board we only have a single power/reset button which has to support the dual role of above two buttons on db410c:

Only one button as pm8916_resin(KEY_POWER), behaviour required:
- The rising edge (or button press) has to be only consumed by PMIC to perform a hard reset of the HMIBSC board if pressed for more than 10 secs.
- The falling edge has to be consumed by the operating system to cleanly reboot the HMIBSC board.

So what you are asking here is that the operating system has to be notified of the rising edge of the button even if it has to just ignore that without any action. Do you really think that would be acceptable as a generic solution for systemd logind?

Also, why DT isn't the right place for correctly describing the intended hardware behaviour? Or am I missing any DT policy which says hardware has to be described the exact way it is rather than the expected way for hardware to behave? BTW, If you want the hardware behaviour to be properly commented then I can do that too.

-Sumit

Quoted 5 lines

Thanks,
Stephan

[1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=be8fc023ef64dcb11042aaa4bb0f29f7e0335d85

#10 lore raw

Hi both,

Quoted 150 lines · Sumit Garg
Quoted 99 lines · Stephan Gerhold
Quoted 80 lines · Sumit Garg
Quoted 68 lines · Stephan Gerhold
Quoted 57 lines · Sumit Garg
Quoted 47 lines · Stephan Gerhold
Quoted 46 lines · Sumit Garg

Add Schneider Electric HMIBSC board DTS. The HMIBSC board is an IIoT Edge Box Core board based on the Qualcomm APQ8016E SoC.

Support for Schneider Electric HMIBSC. Features:
- Qualcomm Snapdragon 410C SoC - APQ8016 (4xCortex A53, Adreno 306)
- 1GiB RAM
- 8GiB eMMC, SD slot
- WiFi and Bluetooth
- 2x Host, 1x Device USB port
- HDMI
- Discrete TPM2 chip over SPI
- USB ethernet adaptors (soldered)

---
 arch/arm64/boot/dts/qcom/Makefile             |   1 +
 .../dts/qcom/apq8016-schneider-hmibsc.dts     | 510 ++++++++++++++++++
 2 files changed, 511 insertions(+)
 create mode 100644 arch/arm64/boot/dts/qcom/apq8016-schneider-hmibsc.dts
arch/arm64/boot/dts/qcom/Makefile +1 -0
index 39889d5f8e12..ad55e52e950b 100644
@@ -5,6 +5,7 @@ apq8016-sbc-usb-host-dtbs     := apq8016-sbc.dtb apq8016-sbc-usb-host.dtbo
 
 dtb-$(CONFIG_ARCH_QCOM)      += apq8016-sbc-usb-host.dtb
 dtb-$(CONFIG_ARCH_QCOM)      += apq8016-sbc-d3-camera-mezzanine.dtb
+dtb-$(CONFIG_ARCH_QCOM)      += apq8016-schneider-hmibsc.dtb
 dtb-$(CONFIG_ARCH_QCOM)      += apq8039-t2.dtb
 dtb-$(CONFIG_ARCH_QCOM)      += apq8094-sony-xperia-kitakami-karin_windy.dtb
 dtb-$(CONFIG_ARCH_QCOM)      += apq8096-db820c.dtb
arch/arm64/boot/dts/qcom/apq8016-schneider-hmibsc.dts new file +4 -0
new file mode 100644
index 000000000000..9c79a31a04db
@@ -0,0 +1,510 @@
[...]
+
+&pm8916_resin {
+     interrupts = <0x0 0x8 1 IRQ_TYPE_EDGE_FALLING>;
+     linux,code = <KEY_POWER>;
Quoted 8 lines

arch/arm64/boot/dts/qcom/apq8016-schneider-hmibsc.dts

Quoted 2 lines
arch/arm64/boot/dts/qcom/apq8016-schneider-hmibsc.dts new file +2 -0
+     status = "okay";
+};

What is the goal of overriding the interrupt here? It looks like you are changing the interrupt type from IRQ_TYPE_EDGE_BOTH to FALLING. This sounds a bit like you want the driver to receive just button release events (or just press events, not sure about the polarity). I'm not sure if the driver will handle this correctly.

Quoted 9 lines

The use-case here is to just act upon button release events and the driver handles this appropriately. Final use-case of the reset button:

- Short press and release leads to normal Linux reboot.
- Long press for more than 10 sec or so leads to a hard reset.

With IRQ_TYPE_EDGE_BOTH, that's not achievable because just a simple press leads to Linux reboot.

Quoted 7 lines

Thanks for explaining your use case. Is the DT really the right place to describe this? In the hardware, this is just a button that provides both press and release events. Linux typically forwards these events to user space, without interpreting them in any way. This means you likely have some user space component that listens to the events (e.g. systemd logind). Ideally that component should be reconfigured to trigger the reboot on release instead of press.

I am not sure if that's really the case. I only see power key value to be reported as follows:

Quoted 8 lines

input_report_key(pwrkey->input, pwrkey->code, 1);
or
input_report_key(pwrkey->input, pwrkey->code, 0);

It's not like a press event being a rising edge (0->1) or a release event being a falling edge (1->0) reported. AFAICS, a reboot is issued whenever the value of power key is reported as "1".

If you look inside the input_report_key() function you can see that the input subsystem internally tracks the key state. input_get_disposition() returns INPUT_IGNORE_EVENT if the key bit already has the same value. Only when the key changes its state, an event is sent to user space. This means that all events reported to user space are effectively rising/falling edges (an event with value "1" is a rising edge 0->1, an event with value "0" is a falling edge 1->0).

Quoted 7 lines

The only reason why setting IRQ_TYPE_EDGE_FALLING works here is because of the workaround added in commit be8fc023ef64 ("Input: pm8941-pwrkey - simulate missed key press events") [1]. No event is reported when you start pressing the key. When you release the key, you get a key press event (rising edge) immediately followed by a key release (falling edge). But the workaround was added to handle potentially missed interrupts, not to inhibit reporting key press events.

I rather see it differently being actually allowing the current use-case to support only the IRQ_TYPE_EDGE_FALLING. As per your description above, a falling edge can only be an event for user-space if we have:

input_report_key(pwrkey->input, pwrkey->code, 1);
input_report_key(pwrkey->input, pwrkey->code, 0);

rather than only

input_report_key(pwrkey->input, pwrkey->code, 0);

which won't trigger any event for user-space, right?

Quoted 6 lines

In my opinion, if you want to perform an action on key release rather than key press then you should adjust the user space program to do so. From the point of view of the hardware DT (and even the kernel), the key press happens when you actually start pressing the key, and not later when you release it.

The reason why we are discussing it back and forth looks like due to lack of clarity as to how HMIBSC board supports this button. The common implementation as per db410c DTS is to have two buttons:

- One button is representing pwrkey(KEY_POWER) which is solely consumed by the operating system to cleanly power off/restart the db410c.
- Another button is representing pm8916_resin(KEY_VOLUMEDOWN) which apart from normal volume down is also consumed by PMIC hardware to perform a hard reset on a long press (if more than 10 sec.).

However, on HMIBSC board we only have a single power/reset button which has to support the dual role of above two buttons on db410c:

Only one button as pm8916_resin(KEY_POWER), behaviour required:
- The rising edge (or button press) has to be only consumed by PMIC to perform a hard reset of the HMIBSC board if pressed for more than 10 secs.
- The falling edge has to be consumed by the operating system to cleanly reboot the HMIBSC board.

Quoted 4 lines

So what you are asking here is that the operating system has to be notified of the rising edge of the button even if it has to just ignore that without any action. Do you really think that would be acceptable as a generic solution for systemd logind?

Yes, this does seem to be a bug in systemd-logind. It appears to have subtly different behaviour depending on if you have HandlePowerKeyLongPress configured or not. If it is set to any action then systemd will wait until you release the key to decide whether to perform HandlePowerKey or HandlePowerKeyLongPress. However if there is no LongPress action configured then it will immediately perform the HandlePowerKey action on key down. [2]

As a workaround, try adding HandlePowerKeyLongPress="lock" to logind.conf and see if that gives you the desired behaviour on short press.

Quoted 6 lines

Also, why DT isn't the right place for correctly describing the intended hardware behaviour? Or am I missing any DT policy which says hardware has to be described the exact way it is rather than the expected way for hardware to behave? BTW, If you want the hardware behaviour to be properly commented then I can do that too.

DT is for describing the hardware, not for dictating its behaviour. As Stephen pointed out, your workaround here only works due to a workaround in the kernel for a bug... DT isn't just consumed by Linux, and some other OS might not behave correctly as a result of this hack.

[1]:
https://github.com/systemd/systemd/blob/main/src/login/logind-button.c#L215

Quoted 8 lines

-Sumit

Quoted 5 lines

Thanks,
Stephan

[1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=be8fc023ef64dcb11042aaa4bb0f29f7e0335d85

Signature · 1 line
// Caleb (they/them)
maintainer
#11 lore raw
In reply to Sumit Garg
Quoted 47 lines · Sumit Garg

Add Schneider Electric HMIBSC board DTS. The HMIBSC board is an IIoT Edge Box Core board based on the Qualcomm APQ8016E SoC. For more information refer to the product page [1].

One of the major difference from db410c is serial port where HMIBSC board uses UART1 as the debug console with a default RS232 mode (UART1 mode mux configured via gpio99 and gpio100).

Support for Schneider Electric HMIBSC. Features:
- Qualcomm Snapdragon 410C SoC - APQ8016 (4xCortex A53, Adreno 306)
- 1GiB RAM
- 8GiB eMMC, SD slot
- WiFi and Bluetooth
- 2x Host, 1x Device USB port
- HDMI
- Discrete TPM2 chip over SPI
- USB ethernet adaptors (soldered)

This series is a v2 since v1 of this DTS file has been reviewed on the U-Boot mailing list [2].

Changes in v3:
- Picked up tags.
- Fixed further DT schema warnings.
- Configure resin/power button interrupt as falling edge.
- Incorporate DTS coding style comments from Krzysztof and Konrad.

Changes in v2:
- Fix DT schema warnings.
- Incorporate suggestions from Stephan.
- Document UART1 mode GPIOs based mux.

[1] https://www.se.com/us/en/product/HMIBSCEA53D1L0T/iiot-edge-box-core-harmony-ipc-emmc-dc-linux-tpm/
[2] https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

Sumit Garg (3):
dt-bindings: vendor-prefixes: Add Schneider Electric
dt-bindings: arm: qcom: Add Schneider Electric HMIBSC board
arm64: dts: qcom: apq8016: Add Schneider HMIBSC board DTS

 .../devicetree/bindings/arm/qcom.yaml         |   1 +
 .../devicetree/bindings/vendor-prefixes.yaml  |   2 +
 arch/arm64/boot/dts/qcom/Makefile             |   1 +
 .../dts/qcom/apq8016-schneider-hmibsc.dts     | 510 ++++++++++++++++++
 4 files changed, 514 insertions(+)
 create mode 100644 arch/arm64/boot/dts/qcom/apq8016-schneider-hmibsc.dts
Quoted 5 lines

--
2.34.1

My bot found new DTB warnings on the .dts files added or changed in this series.

Some warnings may be from an existing SoC .dtsi. Or perhaps the warnings are fixed by another series. Ultimately, it is up to the platform maintainer whether these warnings are acceptable or not. No need to reply unless the platform maintainer has comments.

If you already ran DT checks and didn't see these error(s), then make sure dt-schema is up to date:

  pip3 install dtschema --upgrade

New warnings running 'make CHECK_DTBS=y qcom/apq8016-schneider-hmibsc.dtb' for [email protected]:

arch/arm64/boot/dts/qcom/apq8016-schneider-hmibsc.dtb: /soc@0/audio-codec@771c000: failed to match any schema with compatible: ['qcom,msm8916-wcd-digital-codec'] arch/arm64/boot/dts/qcom/apq8016-schneider-hmibsc.dtb: /soc@0/power-manager@b088000: failed to match any schema with compatible: ['qcom,msm8916-acc'] arch/arm64/boot/dts/qcom/apq8016-schneider-hmibsc.dtb: /soc@0/power-manager@b098000: failed to match any schema with compatible: ['qcom,msm8916-acc'] arch/arm64/boot/dts/qcom/apq8016-schneider-hmibsc.dtb: /soc@0/power-manager@b0a8000: failed to match any schema with compatible: ['qcom,msm8916-acc'] arch/arm64/boot/dts/qcom/apq8016-schneider-hmibsc.dtb: /soc@0/power-manager@b0b8000: failed to match any schema with compatible: ['qcom,msm8916-acc'] arch/arm64/boot/dts/qcom/apq8016-schneider-hmibsc.dtb: /usb-id: failed to match any schema with compatible: ['linux,extcon-usb-gpio']