Skip to content

Commit

Permalink
[CES-2811]
Browse files Browse the repository at this point in the history
- Add a device tree for Ulticontroller 3.2 LVDS and reeorganize device tree files.
  Now the specific ulticontroller dts (3.2 or 4.0) includes the ultimainboard5.0 dtsi
  (with all changes required by the ultimainboard 5.0). Then we have 2 device trees,
  the ulticontroller3.2-lvds-800x320.dts and the ulticontroller4.0-lvds-1024x600.dts
  The postinst script will check the /etc/ultimaker_firmware file for the first
  article number and set a symlink for the device tree file expected by UBoot pointing
  to the ulticontroller device tree for that article number.

- Add kernel support to gpio expander PCA9570 used by Ulticontroller 3.2 LVDS
  • Loading branch information
alexborro committed Jan 2, 2025
1 parent 5f79974 commit 49de21b
Show file tree
Hide file tree
Showing 8 changed files with 126 additions and 11 deletions.
5 changes: 3 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ dtb_build()
for dts in "dts/"*".dts"; do
dts="$(basename "${dts}")"
dt="${dts%.dts}"
echo "Building devicetree blob '${dt}'"
echo -e "\nBuilding devicetree blob '${dt}'"
echo "Using version of DTC: $(dtc --version)"
cpp -nostdinc -undef -D__DTS__ -x assembler-with-cpp \
-I "${LINUX_SRC_DIR}/include" -I "${LINUX_SRC_DIR}/arch/${ARCH}/boot/dts" \
Expand All @@ -345,7 +345,7 @@ dtb_build()
done


echo "Finished building Device-trees."
echo -e "\nFinished building Device-trees.\n"
}

# We need this because the imx8m uart uses this.
Expand Down Expand Up @@ -404,6 +404,7 @@ create_debian_package()
"${SRC_DIR}/debian/control.in" > "${DEBIAN_DIR}/DEBIAN/control"

cp "${SRC_DIR}/debian/preinst" "${DEBIAN_DIR}/DEBIAN/"
cp "${SRC_DIR}/debian/postinst" "${DEBIAN_DIR}/DEBIAN/"

DEB_PACKAGE="${PACKAGE_NAME}_${RELEASE_VERSION}_${ARCH}.deb"

Expand Down
2 changes: 1 addition & 1 deletion configs/sx8m_config_from_yocto_with_extra_usb
Original file line number Diff line number Diff line change
Expand Up @@ -3268,7 +3268,7 @@ CONFIG_GPIO_MAX732X=y
# CONFIG_GPIO_MAX732X_IRQ is not set
CONFIG_GPIO_PCA953X=y
CONFIG_GPIO_PCA953X_IRQ=y
# CONFIG_GPIO_PCA9570 is not set
CONFIG_GPIO_PCA9570=y
# CONFIG_GPIO_PCF857X is not set
# CONFIG_GPIO_TPIC2810 is not set
# end of I2C GPIO expanders
Expand Down
39 changes: 39 additions & 0 deletions debian/postinst
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash

# This script reads the article number file for the list of article numbers
# and tries to match the *first* article number in the list below.
# Then it creates a symbolic link for that article number to the
# correspondent device tree file.

ARTNUM_FILE="/etc/ultimaker_firmware"

TARGET_DTS="cgtsx8m-ultimain5.dtb"
UC32_DTS="ulticontroller3.2-lvds-800x320.dtb"
UC4_DTS="ulticontroller4.0-lvds-1024x600.dtb"

# During the bootstrap configuration stage, if the kernel is configured
# before the mawk package, there will be no awk link pointing to the
# mawk binary, so below we need to specify the correct binary.

first_article_number=$(mawk '/^article_numbers:/ {print $2}' ${ARTNUM_FILE})

echo "-> Recipe's first article number: ${first_article_number}"

case "${first_article_number}" in
10600|10700)
echo "-> Setting Ulticontroller 3.2 LVDS device tree."
ln -sf "${UC32_DTS}" "/boot/${TARGET_DTS}"
;;
227380|10500)
echo "-> Setting Ulticontroller 4.0 LVDS device tree."
ln -sf "${UC4_DTS}" "/boot/${TARGET_DTS}"
;;
# Fallback to the larger screen
*)
echo "-> Falling back to Ulticontroller 4.0 LVDS device tree."
ln -sf "${UC4_DTS}" "/boot/${TARGET_DTS}"
;;
esac



9 changes: 2 additions & 7 deletions debian/preinst
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
#!/bin/bash
# Make sure /boot is mounted before unpacking.

# When building an image, the script will run inside a bootstrap.
# In that case, we should exit before try to mount.
# This situation is realized by checking if the dropbear ssh service
# is running - common situation when deploying new packages to the printer
if [ ! -r /run/sshd.pid ]; then
exit 0
fi;
# The bootstraping tool does not run the debian "preinst" scripts before unpacking
# so it is safe to place commands to be run just in a running printer.

# Check if /boot is already monted
if ! mountpoint -q /boot; then
Expand Down
14 changes: 14 additions & 0 deletions dts/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
### Device Tree Selection

We have 2 device trees, one for each display currently supported by **Ultimainboard 5**:

- *Ulticontroller 4* at 1024x600 (Factor 4, Falcon): `ulticontroller4.0-lvds-1024x600.dts`
- *Ultricontroller 3.2 LVDS* at 800x600 (S6 and S8): `ulticontroller3.2-lvds-800x320.dts`

Both device trees sources includes the Ultimainboard 5 device tree: `ultimainboard5-lvds.dtsi`.
And this one includes the remaining IMX8 definitions (`congatec/imx8mm-cgtsx8m-lvds.dtsi`).

The *UBoot* will look for a device tree file named **`cgtsx8m-ultimain5.dtb`** in the boot partition.
In order to boot the correct DT, the um-kernel post install script will get the **first** recipe
article number (from the file `/etc/ultimaker_firmware`) and will set a symlink named
`cgtsx8m-ultimain5.dtb` pointing to one of those 2 device trees that should be used by this article number.
65 changes: 65 additions & 0 deletions dts/ulticontroller3.2-lvds-800x320.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
* Copyright (C) 2020 - Ultimaker B.V.
* Copyright (C) 2020 - Raymond Siudak <[email protected]>
*/

#include "ultimainboard5-lvds.dtsi"

/ {
lvdspanel {
panel-timing {
clock-frequency = <25820000>;
hactive = <800>;
vactive = <320>;
hsync-len = <46>;
hfront-porch = <4>;
hback-porch = <47>;
vsync-len = <3>;
vfront-porch = <15>;
vback-porch = <184>;
};
};
};

&i2c2 {
clock-frequency = <100000>;
panel_touchscreen: ft5426@38 {
compatible = "edt,edt-ft5406";
reg = <0x38>;
poll-interval = <30>;
reset-gpios = <&panel_gpio 0 GPIO_ACTIVE_LOW>;
touchscreen-size-x = <800>;
touchscreen-size-y = <320>;
};

panel_gpio: pca9570@24 {
compatible = "nxp,pca9570";
gpio-controller;
#gpio-cells = <2>;
reg = <0x24>;
gpio-line-names = "TOUCH_RST", "TOUCH_INT", "PWR_DWN", "ENABLE";
};

panel_lights: pca9632@60 {
compatible = "nxp,pca9632";
#address-cells = <1>;
#size-cells = <0>;
reg = <0x60>;
nxp,totem-pole;
nxp,hw-blink;
panel_backlight: backlight@3 {
label = "white:panel_backlight";
reg = <3>;
linux,default-trigger = "default-on";
};
};

edid_eeprom: 24c32@50 { /* 24LC02B 2K Microchip EEPROM */
// compatible = "24c32", "atmel,24c32";
compatible = "24c32";
reg = <0x50>;
pagesize = <32>;
size = <4096>; // 32Kb (4KB) EEPROM size
};
};

Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* Copyright (C) 2020 - Raymond Siudak <[email protected]>
*/

#include "ultimainboard5-lvds.dtsi"

/ {
lvdspanel {
panel-timing {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
/dts-v1/;

#include "congatec/imx8mm-cgtsx8m-lvds.dtsi"
#include "ulticontroller4.0.dtsi"

/* We do not use the Video Processing Units, so let's disable them.
That prevents multiple enumeration of /dev/videoX devices for
Expand Down

0 comments on commit 49de21b

Please sign in to comment.