aboutsummaryrefslogtreecommitdiff
path: root/target/linux/armsr/base-files/etc/board.d/03_gpio_switches
blob: 72f310277ae311eae4f56ec5fe2979a6c12c6b03 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0-or-later

. /lib/functions/uci-defaults.sh

KERNEL_MAJOR=$(uname -r | awk -F '.' '{print $1}')
KERNEL_MINOR=$(uname -r | awk -F '.' '{print $2}')

board_config_update

board=$(board_name)

case "$board" in
traverse,ten64)
	if [ "${KERNEL_MAJOR}" -ge "6" ] && [ "${KERNEL_MINOR}" -ge "6" ]; 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