meta-digi: update bluetooth to support Japan

Similar commit was done in DEL.

Japanese law limits the maximum transmit power for Bluetooth to 3 mW.
The cert field in OTP will be set to 2 when units are manufactured
for Japan.

Updated the bluez init script to configure Bluetooth for class 2
operation if the cert field is set to 2, and to delete the class 1
configuration file since it would be illegal to use it in Japan.

Signed-off-by: Javier Viguera <javier.viguera@digi.com>
This commit is contained in:
Javier Viguera 2013-08-09 16:26:03 +02:00
parent 1e248b81ac
commit 0907a087c1
5 changed files with 52 additions and 152 deletions

View File

@ -9,18 +9,20 @@ ALLOW_EMPTY_${PN} = "1"
PR = "${DISTRO}.r0"
FILESEXTRAPATHS_prepend := "${THISDIR}/firmware-${PV}:"
SRC_URI = "file://PS_ASIC.pst \
file://RamPatch.txt \
file://PS_ASIC_class_1.pst \
file://PS_ASIC_class_2.pst \
file://readme.txt \
"
SRC_URI = " \
file://PS_ASIC_class_1.pst \
file://PS_ASIC_class_2.pst \
file://RamPatch.txt \
file://readme.txt \
"
S = "${WORKDIR}"
do_install() {
install -d ${D}/lib/firmware/ar3k/1020200/
cp -rfv ${WORKDIR}/PS_ASIC.pst ${D}/lib/firmware/ar3k/1020200/
cp -rfv ${WORKDIR}/RamPatch.txt ${D}/lib/firmware/ar3k/1020200/
find ${D}/lib/firmware/ar3k/1020200/ -type f -exec chmod 644 '{}' ';'
install -d ${D}${base_libdir}/firmware/ar3k/1020200
install -m 0644 PS_ASIC_class_1.pst PS_ASIC_class_2.pst RamPatch.txt readme.txt \
${D}${base_libdir}/firmware/ar3k/1020200/
}
PACKAGES += "${PN}-ar3k"
@ -28,4 +30,3 @@ PACKAGES += "${PN}-ar3k"
FILES_${PN}-ar3k = "/lib/firmware/ar3k/*"
COMPATIBLE_MACHINE = "(mxs)"

View File

@ -1,139 +0,0 @@
// Radio table TAG
#
[H:S]012C
[H:S]00EE
[H:A]B1 B1 12 00 B8 08 FE FE 70 00 16 00 00 20 02 00
0C 09 00 14 00 00 8C 08 00 00 00 40 80 08 78 00
00 01 84 08 AD AC 80 5F 88 08 20 3F 00 41 8C 08
00 00 00 40 94 08 54 25 64 92 98 08 C8 4E 2C 2E
9C 08 C0 20 DA 2C C0 08 B6 0D 01 00 C4 08 6C DB
B6 6D C8 08 DB 36 D3 6D CC 08 60 DB B6 6D 00 09
50 00 92 04 04 09 20 49 00 80 08 09 E0 6F 5B E5
0C 09 00 14 00 00 10 09 81 03 30 F0 14 09 80 80
43 00 18 09 00 00 00 80 1C 09 00 00 00 00 20 09
02 00 00 00 55 00 00 60 02 00 04 07 C4 C1 8B 00
1C 00 00 05 90 01 0C 07 00 0D 00 00 30 00 D8 70
EF 4A 7C 00 B0 D2 5A B1 78 00 DE 7A 58 00 5C 00
01 00 14 01 44 00 00 00 10 E4 84 00 3F F0 E7 04
C0 00 90 01 2C 00 C4 00 80 D6 82 03 DC 00 D8 40
06 00 88 00 52 6C 3D 0E 94 00 41 06 00 00
// Radio table TAG
#
[H:S]012D
[H:S]00F0
[H:A]80 00 20 9C C8 00 90 00 DD DD 97 06 54 00 E0 A6
09 00 10 07 3D A0 00 3D 14 07 A0 80 01 00 18 07
17 55 D1 0C 1C 07 6D 23 00 00 00 05 4A 1C 00 00
04 05 8A 1C 00 00 08 05 CA 1C 00 00 0C 05 0A 1D
00 00 10 05 4A 1D 00 00 14 05 1A 1C 00 00 18 05
5A 1C 00 00 1C 05 9A 1C 00 00 20 05 DA 1C 00 00
24 05 1A 1D 00 00 28 05 5A 1D 00 00 2C 05 2A 1C
00 00 30 05 6A 1C 00 00 34 05 AA 1C 00 00 38 05
EA 1C 00 00 3C 05 2A 1D 00 00 40 05 6A 1D 00 00
44 05 3A 1C 00 00 48 05 2B 1C 00 00 4C 05 6B 1C
00 00 50 05 AB 1C 00 00 54 05 EB 1C 00 00 58 05
2B 1D 00 00 5C 05 5C 1D 00 00 60 05 2C 1C 00 00
64 05 6C 1C 00 00 68 05 AC 1C 00 00 6C 05 1D 1D
00 00 70 05 2D 1C 00 00 74 05 6D 1C 00 00 78 05
AD 1C 00 00 7C 05 ED 1C 00 00 80 05 2D 1D 00 00
// Radio table TAG
#
[H:S]012E
[H:S]00E6
[H:A]84 05 6D 1D 00 00 88 05 3D 1C 00 00 8C 05 7D 1C
00 00 90 05 AE 1C 00 00 94 05 EE 1C 00 00 98 05
2E 1D 00 00 9C 05 6E 1D 00 00 A0 05 3E 1C 00 00
A4 05 7E 1C 00 00 A8 05 BE 1C 00 00 AC 05 2F 1C
00 00 B0 05 6F 1C 00 00 B4 05 AF 1C 00 00 B8 05
EF 1C 00 00 BC 05 2F 1D 00 00 C0 05 6F 1D 00 00
C4 05 AF 1D 00 00 C8 05 BF 00 00 00 CC 05 FF 1C
00 00 D0 05 3F 01 00 00 D4 05 7F 01 00 00 D8 05
BF 01 00 00 DC 05 FF 01 00 00 E0 05 3F 02 00 00
E4 05 7F 12 00 00 E8 05 BF 02 00 00 EC 05 FF 02
00 00 F0 05 3F 03 00 00 F4 05 7F 03 00 00 F8 05
BF 03 00 00 FC 05 FF 03 00 00 04 00 00 00 02 00
10 00 01 CE C0 10 14 00 07 04 00 00 A0 04 00 E9
FF 03 BC 04 FF 41 00 00 01 00 00 C0 02 00 B8 01
01 00 00 00 B2 B2
// System config TAG
#
[H:S]0013
[H:S]00F0
[H:A]C1 C1 20 02 BD 08 FE FE C2 00 00 CC B1 01 20 00
FF CC 02 CC 04 00 B6 FB A9 90 00 21 00 E0 FF CC
08 CC 1E 00 80 84 00 07 DB 05 93 11 FF CC 0E CC
0A 00 E4 FF 61 47 00 00 4D FD 61 47 00 00 58 FD
E8 FF 41 27 04 00 6F FD 41 27 04 00 6C FD EC FF
A0 A7 00 00 2F FD A0 A7 00 00 6D FD F0 FF 60 27
01 00 50 FD 60 27 01 00 6F FD F4 FF A0 C7 04 00
3A FD A0 C7 04 00 89 FD F8 FF 80 C7 08 00 12 FD
80 C7 08 00 58 FD FC FF 40 47 09 00 66 FD 40 47
09 00 0B FD 00 00 80 C7 0D 00 09 FD 80 C7 0D 00
09 FD 02 00 60 C7 11 40 58 FD 60 C7 11 40 58 FD
06 00 40 E7 12 40 58 FD 40 E7 12 40 58 FD FF CC
0F CC 01 01 01 01 07 04 03 33 00 0A 00 04 00 00
60 6D F0 00 66 01 00 00 00 00 00 00 FF CC 10 CC
22 81 A0 0F A0 00 32 00 02 08 0A 64 20 20 0A FF
// System config TAG
#
[H:S]0014
[H:S]00A0
[H:A]20 20 FF CC 11 CC 01 01 FF CC 12 CC 09 01 FF 03
00 FF FF 03 FF CC 13 CC 02 19 B8 0B 17 0F E0 FD
E0 FD E0 FD E0 FD 58 FD 14 FD 58 FD 14 FD 54 25
11 A0 92 24 00 00 00 00 00 00 00 00 00 00 00 00
02 64 04 02 03 FF 04 03 FF CC 1A CC 0C 02 08 00
60 C7 11 40 58 FD 0C 00 40 E7 12 40 58 FD FF CC
18 CC 01 00 05 05 14 0A FF CC 17 CC 20 01 FF CC
16 CC 07 00 C9 B0 B4 00 FF CC 14 CC 01 01 FF CC
15 CC 01 00 08 00 FF CC 1D CC 01 00 00 00 00 00
FB 00 16 F5 08 00 24 24 07 00 1C 1C FF CC C2 C2
// Coex Configuration
#
[H:S]0017
[H:S]0026
[H:A]D1 D1 20 00 02 01 02 09 0C 00 24 1F 12 00 00 01
00 01 00 00 01 01 01 01 01 00 00 00 01 00 01 01
01 01 01 00 D2 D2
//Bdaddr
//#
//[H:S]0001
//[H:S]0006
//[H:A]77 55 42 7f 03 00
//Audio -Master 16bits PCM short frame
#
[H:S]0042
[H:S]0004
[H:A]63 00 01 3d
//Audio - Winbond codec (For TB409)
//#
//[H:S]0042
//[H:S]0004
//[H:A]23 08 01 33
//Audio
#
[H:S]0044
[H:S]0004
[H:A]dd e5 2e 00
//Audio
#
[H:S]0045
[H:S]0004
[H:A]00 00 a7 02
//TLPM
//HOST TLPM 6W (GPIO14) Enable Active low No ack, Target TLPM 4W Enable Active low, No ack
#
[H:S]0023
[H:S]0018
[H:A]06 0E 06 0F 08 08 00 0E 05 00 05 00 2C 01 00 00
E8 03 00 00 C8 00 00 00

View File

@ -27,7 +27,7 @@ ccardimx28js_bt_init() {
#
# Exit if this hardware does not support Bluetooth
#
BLUE_TOOTH_VARIANTS="0x02 0x03 0x04"
BLUE_TOOTH_VARIANTS="0x02 0x03 0x10 0x11"
MOD_VARIANT="$(cat /sys/kernel/ccardimx28/mod_variant)"
if ! echo ${BLUE_TOOTH_VARIANTS} | grep -qs ${MOD_VARIANT}; then
echo "${SCRIPTNAME}: FAILED (variant ${MOD_VARIANT} does not support bluetooth)"
@ -38,7 +38,7 @@ ccardimx28js_bt_init() {
# Get the Bluetooth MAC address from NVRAM. Use a default value if the
# address has not been set.
#
BTADDR="$(sed -e 's,^.*btaddr1=\([^[:blank:]]\+\),\1,g' /proc/cmdline)"
BTADDR="$(sed -ne 's,^.*btaddr1=\([^[:blank:]]\+\)[:blank:]*.*,\1,g;T;p' /proc/cmdline)"
if [ -z "${BTADDR}" -o "${BTADDR}" = "00:00:00:00:00:00" ]; then
BTADDR="00:04:F3:FF:FF:BB"
fi
@ -53,6 +53,44 @@ ccardimx28js_bt_init() {
FW_MAC="/lib/firmware/ar3k/1020200/ar3kbdaddr.pst"
[ -f "${FW_MAC}" ] && [ "$(cat ${FW_MAC})" = "${BTADDR}" ] || echo ${BTADDR} > ${FW_MAC}
BT_CONFIG_FILE="/lib/firmware/ar3k/1020200/PS_ASIC.pst"
BT_CLASS_1_FILE="/lib/firmware/ar3k/1020200/PS_ASIC_class_1.pst"
BT_CLASS_2_FILE="/lib/firmware/ar3k/1020200/PS_ASIC_class_2.pst"
BT_READ_ME="/lib/firmware/ar3k/1020200/readme.txt"
#
# It is illegal to operate a class 1 Bluetooth device in Japan. So see
# if this is a Japanese unit, and, if so, make sure it is configured
# for class 2 Bluetooth.
#
JAPANESE_REGION_CODE="0x2"
REGION_CODE="$(cat /sys/kernel/ccardimx28/mod_cert)"
if [ -n "${REGION_CODE}" -a "${JAPANESE_REGION_CODE}" = "${REGION_CODE}" ]; then
#
# We don't want to wear out flash rewriting the configuration file,
# so only replace the configuration file if it is not the class 2
# version.
#
if ! cmp -s ${BT_CLASS_2_FILE} ${BT_CONFIG_FILE}; then
ln -sf $(basename ${BT_CLASS_2_FILE}) ${BT_CONFIG_FILE}
fi
#
# We don't want the Bluetooth police to drag away our Japanese
# users, so delete the class 1 configuration file and the readme
# file that refers to it.
#
if [ -e ${BT_CLASS_1_FILE} ]; then
rm ${BT_CLASS_1_FILE}
fi
if [ -e ${BT_READ_ME} ]; then
rm ${BT_READ_ME}
fi
elif [ ! -e ${BT_CONFIG_FILE} ]; then
#
# Default to class 1 Bluetooth for non-japanese users.
#
ln -sf $(basename ${BT_CLASS_1_FILE}) ${BT_CONFIG_FILE}
fi
#
# Start the Bluetooth driver and daemon (D-BUS must already be running)
#