summaryrefslogtreecommitdiff
path: root/recipes-kernel/linux
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-kernel/linux')
-rw-r--r--recipes-kernel/linux/linux-toradex-upstream-6.6/0001-arm64-dts-freescale-imx8mp-verdin-replace-sleep-m.patch120
-rw-r--r--recipes-kernel/linux/linux-toradex-upstream-6.6/0001-arm64-dts-ti-k3-am62-verdin-replace-sleep-moci-ho.patch67
-rw-r--r--recipes-kernel/linux/linux-toradex-upstream-6.6/0001-drm-bridge-lt8912b-Add-suspend-resume-support.patch68
-rw-r--r--recipes-kernel/linux/linux-toradex-upstream-6.6/0002-arm64-dts-freescale-imx8mp-verdin-dahlia-support-.patch99
-rw-r--r--recipes-kernel/linux/linux-toradex-upstream-6.6/0002-arm64-dts-ti-k3-am62-verdin-dahlia-support-sleep-.patch70
-rw-r--r--recipes-kernel/linux/linux-toradex-upstream-6.6/0002-drm-bridge-lt8912b-Add-power-supplies.patch92
-rw-r--r--recipes-kernel/linux/linux-toradex-upstream-6.6/0003-arm64-dts-freescale-imx8mm-verdin-replace-sleep-m.patch120
-rw-r--r--recipes-kernel/linux/linux-toradex-upstream-6.6/0004-arm64-dts-freescale-imx8mm-verdin-dahlia-support-.patch90
-rw-r--r--recipes-kernel/linux/linux-toradex-upstream_6.6.bb8
9 files changed, 734 insertions, 0 deletions
diff --git a/recipes-kernel/linux/linux-toradex-upstream-6.6/0001-arm64-dts-freescale-imx8mp-verdin-replace-sleep-m.patch b/recipes-kernel/linux/linux-toradex-upstream-6.6/0001-arm64-dts-freescale-imx8mp-verdin-replace-sleep-m.patch
new file mode 100644
index 0000000..c05aa10
--- /dev/null
+++ b/recipes-kernel/linux/linux-toradex-upstream-6.6/0001-arm64-dts-freescale-imx8mp-verdin-replace-sleep-m.patch
@@ -0,0 +1,120 @@
+From 85eba60ab304cfc9d7053298a6aa7dc4234f2cad Mon Sep 17 00:00:00 2001
+From: Stefan Eichenberger <stefan.eichenberger@toradex.com>
+Date: Fri, 26 Jan 2024 13:33:05 +0100
+Subject: [PATCH v1 1/4] arm64: dts: freescale: imx8mp-verdin: replace
+ sleep-moci hog with regulator
+
+The Verdin family has a signal called sleep-moci which can be used to
+turn off peripherals on the carrier board when the SoM goes into
+suspend. So far we have hogged this signal, which means the peripherals
+are always on and it is not possible to add peripherals that depend on
+the sleep-moci to be on. With this change, we replace the hog with a
+regulator so that peripherals can add their own regulators that use the
+same gpio. Carrier boards that allow peripherals to be powered off in
+suspend can disable this regulator and implement their own regulator to
+control the sleep-moci.
+
+Upstream-Status: Submitted [https://lore.kernel.org/linux-devicetree/20240405160720.5977-1-eichest@gmail.com/]
+Signed-off-by: Stefan Eichenberger <stefan.eichenberger@toradex.com>
+---
+ .../dts/freescale/imx8mp-verdin-dahlia.dtsi | 5 ++++
+ .../boot/dts/freescale/imx8mp-verdin-dev.dtsi | 5 ++++
+ .../dts/freescale/imx8mp-verdin-yavia.dtsi | 5 ++++
+ .../boot/dts/freescale/imx8mp-verdin.dtsi | 26 ++++++++++++-------
+ 4 files changed, 31 insertions(+), 10 deletions(-)
+
+diff --git a/arch/arm64/boot/dts/freescale/imx8mp-verdin-dahlia.dtsi b/arch/arm64/boot/dts/freescale/imx8mp-verdin-dahlia.dtsi
+index 7e9e4b13b5c5..e68e0e6f21e9 100644
+--- a/arch/arm64/boot/dts/freescale/imx8mp-verdin-dahlia.dtsi
++++ b/arch/arm64/boot/dts/freescale/imx8mp-verdin-dahlia.dtsi
+@@ -70,6 +70,11 @@ &flexspi {
+ status = "okay";
+ };
+
++&gpio4 {
++ pinctrl-names = "default";
++ pinctrl-0 = <&pinctrl_ctrl_sleep_moci>;
++};
++
+ /* Current measurement into module VCC */
+ &hwmon {
+ status = "okay";
+diff --git a/arch/arm64/boot/dts/freescale/imx8mp-verdin-dev.dtsi b/arch/arm64/boot/dts/freescale/imx8mp-verdin-dev.dtsi
+index a509b2b7fa85..1a2520d4d6cf 100644
+--- a/arch/arm64/boot/dts/freescale/imx8mp-verdin-dev.dtsi
++++ b/arch/arm64/boot/dts/freescale/imx8mp-verdin-dev.dtsi
+@@ -93,6 +93,11 @@ &flexspi {
+ status = "okay";
+ };
+
++&gpio4 {
++ pinctrl-names = "default";
++ pinctrl-0 = <&pinctrl_ctrl_sleep_moci>;
++};
++
+ &gpio_expander_21 {
+ status = "okay";
+ vcc-supply = <&reg_1p8v>;
+diff --git a/arch/arm64/boot/dts/freescale/imx8mp-verdin-yavia.dtsi b/arch/arm64/boot/dts/freescale/imx8mp-verdin-yavia.dtsi
+index db1722f0d80e..27160024d5b5 100644
+--- a/arch/arm64/boot/dts/freescale/imx8mp-verdin-yavia.dtsi
++++ b/arch/arm64/boot/dts/freescale/imx8mp-verdin-yavia.dtsi
+@@ -100,6 +100,11 @@ &flexcan1 {
+ status = "okay";
+ };
+
++&gpio4 {
++ pinctrl-names = "default";
++ pinctrl-0 = <&pinctrl_ctrl_sleep_moci>;
++};
++
+ &hwmon_temp {
+ status = "okay";
+ };
+diff --git a/arch/arm64/boot/dts/freescale/imx8mp-verdin.dtsi b/arch/arm64/boot/dts/freescale/imx8mp-verdin.dtsi
+index faa17cbbe2fd..e523762947aa 100644
+--- a/arch/arm64/boot/dts/freescale/imx8mp-verdin.dtsi
++++ b/arch/arm64/boot/dts/freescale/imx8mp-verdin.dtsi
+@@ -116,6 +116,22 @@ reg_module_eth1phy: regulator-module-eth1phy {
+ vin-supply = <&reg_vdd_3v3>;
+ };
+
++ /*
++ * By default we enable CTRL_SLEEP_MOCI#, this is required to have
++ * peripherals on the carrier board powered.
++ * If more granularity or power saving is required this can be disabled
++ * in the carrier board device tree files.
++ */
++ reg_force_sleep_moci: regulator-force-sleep-moci {
++ compatible = "regulator-fixed";
++ enable-active-high;
++ /* Verdin CTRL_SLEEP_MOCI# (SODIMM 256) */
++ gpio = <&gpio4 29 GPIO_ACTIVE_HIGH>;
++ regulator-always-on;
++ regulator-boot-on;
++ regulator-name = "CTRL_SLEEP_MOCI#";
++ };
++
+ reg_usb1_vbus: regulator-usb1-vbus {
+ compatible = "regulator-fixed";
+ enable-active-high;
+@@ -439,16 +455,6 @@ &gpio4 {
+ "SODIMM_256",
+ "SODIMM_48",
+ "SODIMM_44";
+-
+- ctrl-sleep-moci-hog {
+- gpio-hog;
+- /* Verdin CTRL_SLEEP_MOCI# (SODIMM 256) */
+- gpios = <29 GPIO_ACTIVE_HIGH>;
+- line-name = "CTRL_SLEEP_MOCI#";
+- output-high;
+- pinctrl-names = "default";
+- pinctrl-0 = <&pinctrl_ctrl_sleep_moci>;
+- };
+ };
+
+ /* On-module I2C */
+--
+2.40.1
+
diff --git a/recipes-kernel/linux/linux-toradex-upstream-6.6/0001-arm64-dts-ti-k3-am62-verdin-replace-sleep-moci-ho.patch b/recipes-kernel/linux/linux-toradex-upstream-6.6/0001-arm64-dts-ti-k3-am62-verdin-replace-sleep-moci-ho.patch
new file mode 100644
index 0000000..b00c911
--- /dev/null
+++ b/recipes-kernel/linux/linux-toradex-upstream-6.6/0001-arm64-dts-ti-k3-am62-verdin-replace-sleep-moci-ho.patch
@@ -0,0 +1,67 @@
+From 4f65d10d84e26e48818e8c16b604fcdcd6b9f2a3 Mon Sep 17 00:00:00 2001
+From: Stefan Eichenberger <stefan.eichenberger@toradex.com>
+Date: Fri, 26 Jan 2024 13:55:00 +0100
+Subject: [PATCH v1 1/2] arm64: dts: ti: k3-am62-verdin: replace sleep-moci hog
+ with regulator
+
+The Verdin family has a signal called sleep-moci which can be used to
+turn off peripherals on the carrier board when the SoM goes into
+suspend. So far we have hogged this signal, which means the peripherals
+are always on and it is not possible to add peripherals that depend on
+the sleep-moci to be on. With this change, we replace the hog with a
+regulator so that peripherals can add their own regulators that use the
+same gpio. Carrier boards that allow peripherals to be powered off in
+suspend can disable this regulator and implement their own regulator to
+control the sleep-moci.
+
+Upstream-Status: Submitted [https://lore.kernel.org/linux-devicetree/20240301084901.16656-1-eichest@gmail.com/]
+Signed-off-by: Stefan Eichenberger <stefan.eichenberger@toradex.com>
+---
+ arch/arm64/boot/dts/ti/k3-am62-verdin.dtsi | 24 ++++++++++++++--------
+ 1 file changed, 16 insertions(+), 8 deletions(-)
+
+diff --git a/arch/arm64/boot/dts/ti/k3-am62-verdin.dtsi b/arch/arm64/boot/dts/ti/k3-am62-verdin.dtsi
+index 6a06724b6d16..ba3b3e18a46d 100644
+--- a/arch/arm64/boot/dts/ti/k3-am62-verdin.dtsi
++++ b/arch/arm64/boot/dts/ti/k3-am62-verdin.dtsi
+@@ -122,6 +122,22 @@ reg_1v8_eth: regulator-1v8-eth {
+ vin-supply = <&reg_1v8>;
+ };
+
++ /*
++ * By default we enable CTRL_SLEEP_MOCI#, this is required to have
++ * peripherals on the carrier board powered.
++ * If more granularity or power saving is required this can be disabled
++ * in the carrier board device tree files.
++ */
++ reg_force_sleep_moci: regulator-force-sleep-moci {
++ compatible = "regulator-fixed";
++ enable-active-high;
++ /* Verdin CTRL_SLEEP_MOCI# (SODIMM 256) */
++ gpio = <&main_gpio0 31 GPIO_ACTIVE_HIGH>;
++ regulator-always-on;
++ regulator-boot-on;
++ regulator-name = "CTRL_SLEEP_MOCI#";
++ };
++
+ /* Verdin SD_1 Power Supply */
+ reg_sdhc1_vmmc: regulator-sdhci1 {
+ compatible = "regulator-fixed";
+@@ -951,14 +967,6 @@ &main_gpio0 {
+ "",
+ "",
+ "";
+-
+- verdin_ctrl_sleep_moci: ctrl-sleep-moci-hog {
+- gpio-hog;
+- /* Verdin CTRL_SLEEP_MOCI# (SODIMM 256) */
+- gpios = <31 GPIO_ACTIVE_HIGH>;
+- line-name = "CTRL_SLEEP_MOCI#";
+- output-high;
+- };
+ };
+
+ &main_gpio1 {
+--
+2.40.1
+
diff --git a/recipes-kernel/linux/linux-toradex-upstream-6.6/0001-drm-bridge-lt8912b-Add-suspend-resume-support.patch b/recipes-kernel/linux/linux-toradex-upstream-6.6/0001-drm-bridge-lt8912b-Add-suspend-resume-support.patch
new file mode 100644
index 0000000..347c4f2
--- /dev/null
+++ b/recipes-kernel/linux/linux-toradex-upstream-6.6/0001-drm-bridge-lt8912b-Add-suspend-resume-support.patch
@@ -0,0 +1,68 @@
+From 0b82a2b70f890e8dd7a46dfbfcce00bd7e434762 Mon Sep 17 00:00:00 2001
+From: Stefan Eichenberger <stefan.eichenberger@toradex.com>
+Date: Wed, 15 Nov 2023 13:13:36 +0100
+Subject: [PATCH] drm/bridge: lt8912b: Add suspend/resume support
+
+Add support for suspend and resume. The lt8912b will power off when
+going into suspend and power on when resuming.
+
+Upstream-Status: Backport [0b82a2b70f890e8dd7a46dfbfcce00bd7e434762]
+
+Signed-off-by: Stefan Eichenberger <stefan.eichenberger@toradex.com>
+Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
+Reviewed-by: Robert Foss <rfoss@kernel.org>
+Signed-off-by: Robert Foss <rfoss@kernel.org>
+Link: https://patchwork.freedesktop.org/patch/msgid/20231115121338.22959-2-francesco@dolcini.it
+---
+ drivers/gpu/drm/bridge/lontium-lt8912b.c | 28 ++++++++++++++++++++++++
+ 1 file changed, 28 insertions(+)
+
+diff --git a/drivers/gpu/drm/bridge/lontium-lt8912b.c b/drivers/gpu/drm/bridge/lontium-lt8912b.c
+index 03532efb893b..097ab04234b7 100644
+--- a/drivers/gpu/drm/bridge/lontium-lt8912b.c
++++ b/drivers/gpu/drm/bridge/lontium-lt8912b.c
+@@ -634,6 +634,33 @@ static const struct drm_bridge_funcs lt8912_bridge_funcs = {
+ .get_edid = lt8912_bridge_get_edid,
+ };
+
++static int lt8912_bridge_resume(struct device *dev)
++{
++ struct lt8912 *lt = dev_get_drvdata(dev);
++ int ret;
++
++ ret = lt8912_hard_power_on(lt);
++ if (ret)
++ return ret;
++
++ ret = lt8912_soft_power_on(lt);
++ if (ret)
++ return ret;
++
++ return lt8912_video_on(lt);
++}
++
++static int lt8912_bridge_suspend(struct device *dev)
++{
++ struct lt8912 *lt = dev_get_drvdata(dev);
++
++ lt8912_hard_power_off(lt);
++
++ return 0;
++}
++
++static DEFINE_SIMPLE_DEV_PM_OPS(lt8912_bridge_pm_ops, lt8912_bridge_suspend, lt8912_bridge_resume);
++
+ static int lt8912_parse_dt(struct lt8912 *lt)
+ {
+ struct gpio_desc *gp_reset;
+@@ -770,6 +797,7 @@ static struct i2c_driver lt8912_i2c_driver = {
+ .driver = {
+ .name = "lt8912",
+ .of_match_table = lt8912_dt_match,
++ .pm = pm_sleep_ptr(&lt8912_bridge_pm_ops),
+ },
+ .probe = lt8912_probe,
+ .remove = lt8912_remove,
+--
+2.40.1
+
diff --git a/recipes-kernel/linux/linux-toradex-upstream-6.6/0002-arm64-dts-freescale-imx8mp-verdin-dahlia-support-.patch b/recipes-kernel/linux/linux-toradex-upstream-6.6/0002-arm64-dts-freescale-imx8mp-verdin-dahlia-support-.patch
new file mode 100644
index 0000000..ac9e06c
--- /dev/null
+++ b/recipes-kernel/linux/linux-toradex-upstream-6.6/0002-arm64-dts-freescale-imx8mp-verdin-dahlia-support-.patch
@@ -0,0 +1,99 @@
+From 9a7d42b76d21916d2eef2dfd6d61a7bdde97fb2b Mon Sep 17 00:00:00 2001
+From: Stefan Eichenberger <stefan.eichenberger@toradex.com>
+Date: Fri, 12 Jan 2024 16:12:14 +0100
+Subject: [PATCH v1 2/4] arm64: dts: freescale: imx8mp-verdin-dahlia: support
+ sleep-moci
+
+Previously, we had the sleep-moci pin set to always on. However, the
+Dahlia carrier board supports disabling the sleep-moci when the system
+is suspended to power down peripherals that support it. This reduces
+overall power consumption. This commit adds support for this feature by
+disabling the reg_force_sleep_moci regulator and adding two new
+regulators for the USB hub and PCIe that can be turned off when the
+system is suspended.
+
+Upstream-Status: Submitted [https://lore.kernel.org/linux-devicetree/20240405160720.5977-1-eichest@gmail.com/]
+Signed-off-by: Stefan Eichenberger <stefan.eichenberger@toradex.com>
+---
+ .../dts/freescale/imx8mp-verdin-dahlia.dtsi | 44 +++++++++++++++++++
+ 1 file changed, 44 insertions(+)
+
+diff --git a/arch/arm64/boot/dts/freescale/imx8mp-verdin-dahlia.dtsi b/arch/arm64/boot/dts/freescale/imx8mp-verdin-dahlia.dtsi
+index e68e0e6f21e9..abad1887040a 100644
+--- a/arch/arm64/boot/dts/freescale/imx8mp-verdin-dahlia.dtsi
++++ b/arch/arm64/boot/dts/freescale/imx8mp-verdin-dahlia.dtsi
+@@ -32,6 +32,25 @@ simple-audio-card,cpu {
+ sound-dai = <&sai1>;
+ };
+ };
++
++ reg_usb_hub: regulator-usb-hub {
++ compatible = "regulator-fixed";
++ enable-active-high;
++ /* Verdin CTRL_SLEEP_MOCI# (SODIMM 256) */
++ gpio = <&gpio4 29 GPIO_ACTIVE_HIGH>;
++ regulator-boot-on;
++ regulator-name = "HUB_PWR_EN";
++ };
++
++ reg_pcie: regulator-pcie {
++ compatible = "regulator-fixed";
++ enable-active-high;
++ /* Verdin CTRL_SLEEP_MOCI# (SODIMM 256) */
++ gpio = <&gpio4 29 GPIO_ACTIVE_HIGH>;
++ regulator-boot-on;
++ regulator-name = "PCIE_1_PWR_EN";
++ startup-delay-us = <100000>;
++ };
+ };
+
+ &backlight {
+@@ -117,6 +136,7 @@ wm8904_1a: audio-codec@1a {
+
+ /* Verdin PCIE_1 */
+ &pcie {
++ vpcie-supply = <&reg_pcie>;
+ status = "okay";
+ };
+
+@@ -143,6 +163,11 @@ &reg_usdhc2_vmmc {
+ vin-supply = <&reg_3p3v>;
+ };
+
++/* We support turning off sleep moci on Dahlia */
++&reg_force_sleep_moci {
++ status = "disabled";
++};
++
+ /* Verdin I2S_1 */
+ &sai1 {
+ assigned-clocks = <&clk IMX8MP_CLK_SAI1>;
+@@ -186,6 +211,25 @@ &usb3_phy1 {
+ status = "okay";
+ };
+
++&usb_dwc3_1 {
++ #address-cells = <1>;
++ #size-cells = <0>;
++
++ usb_hub_3_0: usb-hub@1 {
++ compatible = "usb424,5744";
++ reg = <1>;
++ peer-hub = <&usb_hub_2_0>;
++ vdd-supply = <&reg_usb_hub>;
++ };
++
++ usb_hub_2_0: usb-hub@2 {
++ compatible = "usb424,2744";
++ reg = <2>;
++ peer-hub = <&usb_hub_3_0>;
++ vdd-supply = <&reg_usb_hub>;
++ };
++};
++
+ /* Verdin SD_1 */
+ &usdhc2 {
+ status = "okay";
+--
+2.40.1
+
diff --git a/recipes-kernel/linux/linux-toradex-upstream-6.6/0002-arm64-dts-ti-k3-am62-verdin-dahlia-support-sleep-.patch b/recipes-kernel/linux/linux-toradex-upstream-6.6/0002-arm64-dts-ti-k3-am62-verdin-dahlia-support-sleep-.patch
new file mode 100644
index 0000000..9f02980
--- /dev/null
+++ b/recipes-kernel/linux/linux-toradex-upstream-6.6/0002-arm64-dts-ti-k3-am62-verdin-dahlia-support-sleep-.patch
@@ -0,0 +1,70 @@
+From ae6bfe80045f0b01b352dc03ff99c9afdcaff98b Mon Sep 17 00:00:00 2001
+From: Stefan Eichenberger <stefan.eichenberger@toradex.com>
+Date: Fri, 26 Jan 2024 13:58:53 +0100
+Subject: [PATCH v1 2/2] arm64: dts: ti: k3-am62-verdin-dahlia: support
+ sleep-moci
+
+Previously, we had the sleep-moci pin set to always on. However, the
+Dahlia carrier board supports disabling the sleep-moci when the system
+is suspended to power down peripherals that support it. This reduces
+overall power consumption. This commit adds support for this feature by
+disabling the reg_force_sleep_moci regulator and adding a new regulator
+for the USB hub that can be turned off when the system is suspended.
+
+Upstream-Status: Submitted [https://lore.kernel.org/linux-devicetree/20240301084901.16656-1-eichest@gmail.com/]
+Signed-off-by: Stefan Eichenberger <stefan.eichenberger@toradex.com>
+---
+ .../boot/dts/ti/k3-am62-verdin-dahlia.dtsi | 22 +++++++++++++++++++
+ 1 file changed, 22 insertions(+)
+
+diff --git a/arch/arm64/boot/dts/ti/k3-am62-verdin-dahlia.dtsi b/arch/arm64/boot/dts/ti/k3-am62-verdin-dahlia.dtsi
+index bf6d27e70bc4..bb066e726527 100644
+--- a/arch/arm64/boot/dts/ti/k3-am62-verdin-dahlia.dtsi
++++ b/arch/arm64/boot/dts/ti/k3-am62-verdin-dahlia.dtsi
+@@ -43,6 +43,15 @@ simple-audio-card,cpu {
+ sound-dai = <&mcasp0>;
+ };
+ };
++
++ reg_usb_hub: regulator-usb-hub {
++ compatible = "regulator-fixed";
++ enable-active-high;
++ /* Verdin CTRL_SLEEP_MOCI# (SODIMM 256) */
++ gpio = <&main_gpio0 31 GPIO_ACTIVE_HIGH>;
++ regulator-boot-on;
++ regulator-name = "HUB_PWR_EN";
++ };
+ };
+
+ /* Verdin ETHs */
+@@ -183,6 +192,11 @@ &ospi0 {
+ status = "okay";
+ };
+
++/* Do not force CTRL_SLEEP_MOCI# always enabled */
++&reg_force_sleep_moci {
++ status = "disabled";
++};
++
+ /* Verdin SD_1 */
+ &sdhci1 {
+ ti,driver-strength-ohm = <33>;
+@@ -204,7 +218,15 @@ &usbss1 {
+ };
+
+ &usb1 {
++ #address-cells = <1>;
++ #size-cells = <0>;
+ status = "okay";
++
++ usb-hub@1 {
++ compatible = "usb424,2744";
++ reg = <1>;
++ vdd-supply = <&reg_usb_hub>;
++ };
+ };
+
+ /* Verdin CTRL_WAKE1_MICO# */
+--
+2.40.1
+
diff --git a/recipes-kernel/linux/linux-toradex-upstream-6.6/0002-drm-bridge-lt8912b-Add-power-supplies.patch b/recipes-kernel/linux/linux-toradex-upstream-6.6/0002-drm-bridge-lt8912b-Add-power-supplies.patch
new file mode 100644
index 0000000..e4a81b3
--- /dev/null
+++ b/recipes-kernel/linux/linux-toradex-upstream-6.6/0002-drm-bridge-lt8912b-Add-power-supplies.patch
@@ -0,0 +1,92 @@
+From f6d8a80f1d10ff01cff3ac26e242165a270bbbad Mon Sep 17 00:00:00 2001
+From: Stefan Eichenberger <stefan.eichenberger@toradex.com>
+Date: Wed, 15 Nov 2023 13:13:38 +0100
+Subject: [PATCH] drm/bridge: lt8912b: Add power supplies
+
+Add supplies to the driver that can be used to turn the Lontium lt8912b
+on and off. It can have up to 7 independent supplies, we add them all
+and enable/disable them with bulk_enable/disable.
+
+Upstream-Status: Backport [f168c7f7d1a0cb12a4888af9f3f907139372f137]
+
+Signed-off-by: Stefan Eichenberger <stefan.eichenberger@toradex.com>
+Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
+Reviewed-by: Robert Foss <rfoss@kernel.org>
+Signed-off-by: Robert Foss <rfoss@kernel.org>
+Link: https://patchwork.freedesktop.org/patch/msgid/20231115121338.22959-4-francesco@dolcini.it
+---
+ drivers/gpu/drm/bridge/lontium-lt8912b.c | 30 ++++++++++++++++++++++++
+ 1 file changed, 30 insertions(+)
+
+diff --git a/drivers/gpu/drm/bridge/lontium-lt8912b.c b/drivers/gpu/drm/bridge/lontium-lt8912b.c
+index 097ab04234b7..273157428c82 100644
+--- a/drivers/gpu/drm/bridge/lontium-lt8912b.c
++++ b/drivers/gpu/drm/bridge/lontium-lt8912b.c
+@@ -43,6 +43,8 @@ struct lt8912 {
+
+ struct videomode mode;
+
++ struct regulator_bulk_data supplies[7];
++
+ u8 data_lanes;
+ bool is_power_on;
+ };
+@@ -257,6 +259,12 @@ static int lt8912_free_i2c(struct lt8912 *lt)
+
+ static int lt8912_hard_power_on(struct lt8912 *lt)
+ {
++ int ret;
++
++ ret = regulator_bulk_enable(ARRAY_SIZE(lt->supplies), lt->supplies);
++ if (ret)
++ return ret;
++
+ gpiod_set_value_cansleep(lt->gp_reset, 0);
+ msleep(20);
+
+@@ -267,6 +275,9 @@ static void lt8912_hard_power_off(struct lt8912 *lt)
+ {
+ gpiod_set_value_cansleep(lt->gp_reset, 1);
+ msleep(20);
++
++ regulator_bulk_disable(ARRAY_SIZE(lt->supplies), lt->supplies);
++
+ lt->is_power_on = false;
+ }
+
+@@ -661,6 +672,21 @@ static int lt8912_bridge_suspend(struct device *dev)
+
+ static DEFINE_SIMPLE_DEV_PM_OPS(lt8912_bridge_pm_ops, lt8912_bridge_suspend, lt8912_bridge_resume);
+
++static int lt8912_get_regulators(struct lt8912 *lt)
++{
++ unsigned int i;
++ const char * const supply_names[] = {
++ "vdd", "vccmipirx", "vccsysclk", "vcclvdstx",
++ "vcchdmitx", "vcclvdspll", "vcchdmipll"
++ };
++
++ for (i = 0; i < ARRAY_SIZE(lt->supplies); i++)
++ lt->supplies[i].supply = supply_names[i];
++
++ return devm_regulator_bulk_get(lt->dev, ARRAY_SIZE(lt->supplies),
++ lt->supplies);
++}
++
+ static int lt8912_parse_dt(struct lt8912 *lt)
+ {
+ struct gpio_desc *gp_reset;
+@@ -712,6 +738,10 @@ static int lt8912_parse_dt(struct lt8912 *lt)
+ goto err_free_host_node;
+ }
+
++ ret = lt8912_get_regulators(lt);
++ if (ret)
++ goto err_free_host_node;
++
+ of_node_put(port_node);
+ return 0;
+
+--
+2.40.1
+
diff --git a/recipes-kernel/linux/linux-toradex-upstream-6.6/0003-arm64-dts-freescale-imx8mm-verdin-replace-sleep-m.patch b/recipes-kernel/linux/linux-toradex-upstream-6.6/0003-arm64-dts-freescale-imx8mm-verdin-replace-sleep-m.patch
new file mode 100644
index 0000000..2fdde24
--- /dev/null
+++ b/recipes-kernel/linux/linux-toradex-upstream-6.6/0003-arm64-dts-freescale-imx8mm-verdin-replace-sleep-m.patch
@@ -0,0 +1,120 @@
+From dbe145ebf4edaec4bcd9cc632defe58dad030626 Mon Sep 17 00:00:00 2001
+From: Stefan Eichenberger <stefan.eichenberger@toradex.com>
+Date: Fri, 26 Jan 2024 13:37:52 +0100
+Subject: [PATCH v1 3/4] arm64: dts: freescale: imx8mm-verdin: replace
+ sleep-moci hog with regulator
+
+The Verdin family has a signal called sleep-moci which can be used to
+turn off peripherals on the carrier board when the SoM goes into
+suspend. So far we have hogged this signal, which means the peripherals
+are always on and it is not possible to add peripherals that depend on
+the sleep-moci to be on. With this change, we replace the hog with a
+regulator so that peripherals can add their own regulators that use the
+same gpio. Carrier boards that allow peripherals to be powered off in
+suspend can disable this regulator and implement their own regulator to
+control the sleep-moci.
+
+Upstream-Status: Submitted [https://lore.kernel.org/linux-devicetree/20240405160720.5977-1-eichest@gmail.com/]
+Signed-off-by: Stefan Eichenberger <stefan.eichenberger@toradex.com>
+---
+ .../dts/freescale/imx8mm-verdin-dahlia.dtsi | 5 ++++
+ .../boot/dts/freescale/imx8mm-verdin-dev.dtsi | 5 ++++
+ .../dts/freescale/imx8mm-verdin-yavia.dtsi | 5 ++++
+ .../boot/dts/freescale/imx8mm-verdin.dtsi | 26 ++++++++++++-------
+ 4 files changed, 31 insertions(+), 10 deletions(-)
+
+diff --git a/arch/arm64/boot/dts/freescale/imx8mm-verdin-dahlia.dtsi b/arch/arm64/boot/dts/freescale/imx8mm-verdin-dahlia.dtsi
+index 1cff0b829357..b64dac4f29c2 100644
+--- a/arch/arm64/boot/dts/freescale/imx8mm-verdin-dahlia.dtsi
++++ b/arch/arm64/boot/dts/freescale/imx8mm-verdin-dahlia.dtsi
+@@ -58,6 +58,11 @@ &flexspi {
+ status = "okay";
+ };
+
++&gpio5 {
++ pinctrl-names = "default";
++ pinctrl-0 = <&pinctrl_ctrl_sleep_moci>;
++};
++
+ /* Current measurement into module VCC */
+ &hwmon {
+ status = "okay";
+diff --git a/arch/arm64/boot/dts/freescale/imx8mm-verdin-dev.dtsi b/arch/arm64/boot/dts/freescale/imx8mm-verdin-dev.dtsi
+index 3c4b8ca125e3..95b7c9a03a23 100644
+--- a/arch/arm64/boot/dts/freescale/imx8mm-verdin-dev.dtsi
++++ b/arch/arm64/boot/dts/freescale/imx8mm-verdin-dev.dtsi
+@@ -78,6 +78,11 @@ &i2c3 {
+ status = "okay";
+ };
+
++&gpio5 {
++ pinctrl-names = "default";
++ pinctrl-0 = <&pinctrl_ctrl_sleep_moci>;
++};
++
+ &gpio_expander_21 {
+ status = "okay";
+ };
+diff --git a/arch/arm64/boot/dts/freescale/imx8mm-verdin-yavia.dtsi b/arch/arm64/boot/dts/freescale/imx8mm-verdin-yavia.dtsi
+index 1e28c78e381f..763f069e8405 100644
+--- a/arch/arm64/boot/dts/freescale/imx8mm-verdin-yavia.dtsi
++++ b/arch/arm64/boot/dts/freescale/imx8mm-verdin-yavia.dtsi
+@@ -81,6 +81,11 @@ &gpio3 {
+ pinctrl-0 = <&pinctrl_gpios_ext_yavia>;
+ };
+
++&gpio5 {
++ pinctrl-names = "default";
++ pinctrl-0 = <&pinctrl_ctrl_sleep_moci>;
++};
++
+ &hwmon_temp {
+ status = "okay";
+ };
+diff --git a/arch/arm64/boot/dts/freescale/imx8mm-verdin.dtsi b/arch/arm64/boot/dts/freescale/imx8mm-verdin.dtsi
+index 6f0811587142..4768b05fd765 100644
+--- a/arch/arm64/boot/dts/freescale/imx8mm-verdin.dtsi
++++ b/arch/arm64/boot/dts/freescale/imx8mm-verdin.dtsi
+@@ -110,6 +110,22 @@ reg_ethphy: regulator-ethphy {
+ startup-delay-us = <200000>;
+ };
+
++ /*
++ * By default we enable CTRL_SLEEP_MOCI#, this is required to have
++ * peripherals on the carrier board powered.
++ * If more granularity or power saving is required this can be disabled
++ * in the carrier board device tree files.
++ */
++ reg_force_sleep_moci: regulator-force-sleep-moci {
++ compatible = "regulator-fixed";
++ enable-active-high;
++ /* Verdin CTRL_SLEEP_MOCI# (SODIMM 256) */
++ gpio = <&gpio5 1 GPIO_ACTIVE_HIGH>;
++ regulator-always-on;
++ regulator-boot-on;
++ regulator-name = "CTRL_SLEEP_MOCI#";
++ };
++
+ reg_usb_otg1_vbus: regulator-usb-otg1 {
+ compatible = "regulator-fixed";
+ enable-active-high;
+@@ -333,16 +349,6 @@ &gpio5 {
+ "SODIMM_212",
+ "SODIMM_151",
+ "SODIMM_153";
+-
+- ctrl-sleep-moci-hog {
+- gpio-hog;
+- /* Verdin CTRL_SLEEP_MOCI# (SODIMM 256) */
+- gpios = <1 GPIO_ACTIVE_HIGH>;
+- line-name = "CTRL_SLEEP_MOCI#";
+- output-high;
+- pinctrl-names = "default";
+- pinctrl-0 = <&pinctrl_ctrl_sleep_moci>;
+- };
+ };
+
+ /* On-module I2C */
+--
+2.40.1
+
diff --git a/recipes-kernel/linux/linux-toradex-upstream-6.6/0004-arm64-dts-freescale-imx8mm-verdin-dahlia-support-.patch b/recipes-kernel/linux/linux-toradex-upstream-6.6/0004-arm64-dts-freescale-imx8mm-verdin-dahlia-support-.patch
new file mode 100644
index 0000000..7749b0e
--- /dev/null
+++ b/recipes-kernel/linux/linux-toradex-upstream-6.6/0004-arm64-dts-freescale-imx8mm-verdin-dahlia-support-.patch
@@ -0,0 +1,90 @@
+From fad8b15c2eabbded61c821a04238b5fa2fb596c9 Mon Sep 17 00:00:00 2001
+From: Stefan Eichenberger <stefan.eichenberger@toradex.com>
+Date: Fri, 26 Jan 2024 13:41:14 +0100
+Subject: [PATCH v1 4/4] arm64: dts: freescale: imx8mm-verdin-dahlia: support
+ sleep-moci
+
+Previously, we had the sleep-moci pin set to always on. However, the
+Dahlia carrier board supports disabling the sleep-moci when the system
+is suspended to power down peripherals that support it. This reduces
+overall power consumption. This commit adds support for this feature by
+disabling the reg_force_sleep_moci regulator and adding two new
+regulators for the USB hub and PCIe that can be turned off when the
+system is suspended.
+
+Upstream-Status: Submitted [https://lore.kernel.org/linux-devicetree/20240405160720.5977-1-eichest@gmail.com/]
+Signed-off-by: Stefan Eichenberger <stefan.eichenberger@toradex.com>
+---
+ .../dts/freescale/imx8mm-verdin-dahlia.dtsi | 33 +++++++++++++++++++
+ 1 file changed, 33 insertions(+)
+
+diff --git a/arch/arm64/boot/dts/freescale/imx8mm-verdin-dahlia.dtsi b/arch/arm64/boot/dts/freescale/imx8mm-verdin-dahlia.dtsi
+index b64dac4f29c2..393fc9e20423 100644
+--- a/arch/arm64/boot/dts/freescale/imx8mm-verdin-dahlia.dtsi
++++ b/arch/arm64/boot/dts/freescale/imx8mm-verdin-dahlia.dtsi
+@@ -32,6 +32,25 @@ simple-audio-card,cpu {
+ sound-dai = <&sai2>;
+ };
+ };
++
++ reg_usb_hub: regulator-usb-hub {
++ compatible = "regulator-fixed";
++ enable-active-high;
++ /* Verdin CTRL_SLEEP_MOCI# (SODIMM 256) */
++ gpio = <&gpio5 1 GPIO_ACTIVE_HIGH>;
++ regulator-boot-on;
++ regulator-name = "HUB_PWR_EN";
++ };
++
++ reg_pcie: regulator-pcie {
++ compatible = "regulator-fixed";
++ enable-active-high;
++ /* Verdin CTRL_SLEEP_MOCI# (SODIMM 256) */
++ gpio = <&gpio5 1 GPIO_ACTIVE_HIGH>;
++ regulator-boot-on;
++ regulator-name = "PCIE_1_PWR_EN";
++ startup-delay-us = <100000>;
++ };
+ };
+
+ /* Verdin SPI_1 */
+@@ -98,6 +117,7 @@ wm8904_1a: audio-codec@1a {
+
+ /* Verdin PCIE_1 */
+ &pcie0 {
++ vpcie-supply = <&reg_pcie>;
+ status = "okay";
+ };
+
+@@ -120,6 +140,11 @@ &pwm3 {
+ status = "okay";
+ };
+
++/* We support turning off sleep moci on Dahlia */
++&reg_force_sleep_moci {
++ status = "disabled";
++};
++
+ /* Verdin I2S_1 */
+ &sai2 {
+ status = "okay";
+@@ -148,8 +173,16 @@ &usbotg1 {
+
+ /* Verdin USB_2 */
+ &usbotg2 {
++ #address-cells = <1>;
++ #size-cells = <0>;
+ disable-over-current;
+ status = "okay";
++
++ usb-hub@1 {
++ compatible = "usb424,2744";
++ reg = <1>;
++ vdd-supply = <&reg_usb_hub>;
++ };
+ };
+
+ /* Verdin SD_1 */
+--
+2.40.1
+
diff --git a/recipes-kernel/linux/linux-toradex-upstream_6.6.bb b/recipes-kernel/linux/linux-toradex-upstream_6.6.bb
index 01b985a..b0e9c5e 100644
--- a/recipes-kernel/linux/linux-toradex-upstream_6.6.bb
+++ b/recipes-kernel/linux/linux-toradex-upstream_6.6.bb
@@ -21,6 +21,14 @@ TDX_PATCHES = " \
file://0003-dt-bindings-power-reset-gpio-poweroff-Add-priority-p.patch \
file://0004-media-i2c-ov5640-Implement-get_mbus_config.patch \
file://0004-power-reset-gpio-poweroff-make-sys-handler-priority-.patch \
+ file://0001-drm-bridge-lt8912b-Add-suspend-resume-support.patch \
+ file://0002-drm-bridge-lt8912b-Add-power-supplies.patch \
+ file://0001-arm64-dts-freescale-imx8mp-verdin-replace-sleep-m.patch \
+ file://0002-arm64-dts-freescale-imx8mp-verdin-dahlia-support-.patch \
+ file://0003-arm64-dts-freescale-imx8mm-verdin-replace-sleep-m.patch \
+ file://0004-arm64-dts-freescale-imx8mm-verdin-dahlia-support-.patch \
+ file://0001-arm64-dts-ti-k3-am62-verdin-replace-sleep-moci-ho.patch \
+ file://0002-arm64-dts-ti-k3-am62-verdin-dahlia-support-sleep-.patch \
"
PV = "6.6"
LINUX_VERSION ?= "6.6.20"