difos/target/linux/armsr/base-files/etc/board.d/03_gpio_switches
Shiji Yang 2f944ecd3e treewide: simplify kernel version number comparisons
Directly call the function "get_linux_version()" to get the integer
kernel version number.

Signed-off-by: Shiji Yang <yangshiji66@outlook.com>
Link: https://github.com/openwrt/openwrt/pull/19172
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2025-07-14 22:30:20 +02:00

29 lines
874 B
Bash

#!/bin/sh
# SPDX-License-Identifier: GPL-2.0-or-later
. /lib/functions/system.sh
. /lib/functions/uci-defaults.sh
board_config_update
board=$(board_name)
case "$board" in
traverse,ten64)
if [ "$(get_linux_version)" -ge "606000" ]; then
I2C_GPIO_BASE=640
else
I2C_GPIO_BASE=368
fi
ucidef_add_gpio_switch "lte_reset" "Cell Modem Reset" "$(($I2C_GPIO_BASE + 8))"
ucidef_add_gpio_switch "lte_power" "Cell Modem Power" "$(($I2C_GPIO_BASE + 9))"
ucidef_add_gpio_switch "lte_disable" "Cell Modem Airplane mode" "$((I2C_GPIO_BASE + 10))"
ucidef_add_gpio_switch "gnss_disable" "Cell Modem Disable GNSS receiver" "$(($I2C_GPIO_BASE + 11))"
ucidef_add_gpio_switch "lower_sfp_txidsable" "Lower SFP+ TX Disable" "$(($I2C_GPIO_BASE + 1))"
ucidef_add_gpio_switch "upper_sfp_txdisable" "Upper SFP+ TX Disable" "$(($I2C_GPIO_BASE + 5))"
;;
esac
board_config_flush
exit 0