Android11 使用 wwan 驱动正常移植 m750 , 本篇为您简述 m750 移植过程。
提示:此文章为 rk3568 移植 m750,下一篇 rk3568 LTE selinux 权限配置。
kernle/drivers/usb/serial/option.c
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -83,6 +83,15 @@ static void option_instat_callback(struct urb *urb);
#define HUAWEI_PRODUCT_K4605 0x14C6
#define HUAWEI_PRODUCT_E173S6 0x1C07
+/*[MEIG-zhaopf-2019-11-04]add for meig modem supported {*/
+#define MEIG_VENDOR_ID 0x2DEE
+#define MEIG_PRODUCT_SRM815 0x4D22
+#define MEIG_PRODUCT_SRM815_ECM 0x4D23
+#define MEIG_PRODUCT_SLM790 0x4D20
+#define MEIG_QCM_VENDOR_ID 0x05C6
+#define MEIG_QCM_PRODUCT_SLM750_SRM815_SLM868 0xF601
+/*[MEIG-zhaopf-2019-11-04]add for meig modem supported }*/
+
#define QUANTA_VENDOR_ID 0x0408
#define QUANTA_PRODUCT_Q101 0xEA02
#define QUANTA_PRODUCT_Q111 0xEA03
@@ -608,6 +617,16 @@ static const struct usb_device_id option_ids[] = {
{ USB_DEVICE(0x2C7C, 0x6000) }, /* Quectel m7500/UC200 */
{ .match_flags = USB_DEVICE_ID_MATCH_VENDOR, .idVendor = 0x2C7C }, /* Match All Quectel Modules */
#endif
+ /*[MEIG-zhaopf-2019-11-04]add for meig modem supported {*/
+ { USB_DEVICE(MEIG_VENDOR_ID, MEIG_PRODUCT_SRM815),
+ .driver_info = RSVD(4) | RSVD(5) | RSVD(6) | RSVD(7) },
+ { USB_DEVICE(MEIG_VENDOR_ID, MEIG_PRODUCT_SRM815_ECM),
+ .driver_info = RSVD(4) | RSVD(5) | RSVD(6) | RSVD(7)},
+ { USB_DEVICE(MEIG_QCM_VENDOR_ID, MEIG_QCM_PRODUCT_SLM750_SRM815_SLM868),
+ .driver_info = RSVD(4) | RSVD(5) | RSVD(6) | RSVD(7)},
+ { USB_DEVICE(MEIG_VENDOR_ID, MEIG_PRODUCT_SLM790),
+ .driver_info = RSVD(0) | RSVD(5) | RSVD(6) | RSVD(7)},
+ /*[MEIG-zhaopf-2019-11-04]add for meig modem supported }*/
{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) },
{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) },
{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA_LIGHT) },
kernel/driver/Makefile
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -192,3 +192,4 @@ obj-$(CONFIG_RK_NAND) += rk_nand/
obj-$(CONFIG_RK_HEADSET) += headset_observe/
obj-$(CONFIG_RK_FLASH) += rkflash/
obj-$(CONFIG_ROCKCHIP_RKNPU) += rknpu/
+obj-y += meig_gobinet_driver/
kernel/driver/Kconfig
diff --git a/drivers/Kconfig b/drivers/Kconfig
index dc65838eff4c..e83643390474 100644
--- a/drivers/Kconfig
+++ b/drivers/Kconfig
@@ -231,4 +231,6 @@ source "drivers/headset_observe/Kconfig"
source "drivers/rknpu/Kconfig"
+source "drivers/meig_gobinet_driver/Kconfig"
+
endmenu
解压 Meig_GobiNet_Driver_V1.4.2 驱动到 kernel/driver/meig_gobinet_driver/
mkdir -p kernel/driver/meig_gobinet_driver/
unzip -D kernel/driver/meig_gobinet_driver/ Meig_GobiNet_Driver_V1.4.2.zip
查看原理图中 m750 模组上电时序控制
m750 disable 由gpio1_B5控制,设备树中使用 power 控制信号;
m750 reset 由于gpio1_A2控制,设备树中使用 reset 控制信号;
m750 供电由于gpio3_A6控制,设备树中使用 vbat 控制信号;
# 新增设备描述节点要 在根节点上添加
/ {
+ rk_modem: rk-modem {
+ compatible="4g-modem-platdata";
+ pinctrl-names = "default";
+ pinctrl-0 = <<e_vbat <e_power_en <e_reset>;
+ 4G,vbat-gpio = <&gpio3 RK_PA6 GPIO_ACTIVE_HIGH>; #m750 vbat控制pin
+ 4G,power-gpio = <&gpio1 RK_PB5 GPIO_ACTIVE_HIGH>; #m750 power控制 pin
+ 4G,reset-gpio = <&gpio1 RK_PA2 GPIO_ACTIVE_LOW>; #m750 复位pin
+ };
# 增加pinctrl 设定
&pinctrl {
+ rk-modem {
+ lte_vbat: lte-vbat {
+ rockchip,pins = <3 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>;
+ };
+
+ lte_power_en: lte-power-en {
+ rockchip,pins = <1 RK_PB5 RK_FUNC_GPIO &pcfg_pull_none>;
+ };
+
+ lte_reset: lte-reset {
+ rockchip,pins = <1 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>;
+ };
+ };
+
编译内核完成后,刷机验证可正常识别到 m750, 并生成 /dev/ttyUSBx节点,则证明驱动移植完成。如果所有组 所有者不是radio,则需要添加权限。如果未生成 /dev/cdc-wdm0 节点,请继续 system/core 移植驱动。
$ ls /dev/ttyUSB[0-3] -lh
crw-rw---- 1 radio radio 188, 0 2022-06-22 19:44 /dev/ttyUSB0
crw-rw---- 1 radio radio 188, 1 2022-06-22 19:44 /dev/ttyUSB1
crw-rw---- 1 radio radio 188, 2 2022-06-22 20:05 /dev/ttyUSB2
crw-rw---- 1 radio radio 188, 3 2022-06-22 19:44 /dev/ttyUSB3
$ ls /dev/cdc-wdm* -lh
crw-rw---- 1 radio radio 180, 176 2022-06-23 10:26 /dev/cdc-wdm0
system/core/init/devices.cpp
--- a/init/devices.cpp
+++ b/init/devices.cpp
@@ -492,6 +492,11 @@ void DeviceHandler::HandleUevent(const Uevent& uevent) {
int device_id = uevent.minor % 128 + 1;
devpath = StringPrintf("/dev/bus/usb/%03d/%03d", bus_id, device_id);
}
+#if 1 //add by quectel for mknod /dev/cdc-wdm0
+ } else if (uevent.subsystem == "usbmisc" && !uevent.device_name.empty()) {
+ devpath = "/dev/" + uevent.device_name;
+#endif
+
} else if (StartsWith(uevent.subsystem, "usb")) {
rk3566 rk3568 在 device/rockchip/common/ueventd.rockchip.rc 怎加权限
+/dev/ttyUSB* 0660 radio radio
/dev/ttyACM* 0660 radio radio
m750 相关库以及拨号脚本需要找模组供应商索要包含 rild 拨号文件和 rild 依赖库资料;如果厂家提供参考 rild.te 权限配置文件,可一并移植。
特别注意:模组厂家的rild服务因权限不同导致 rild服务缺少 seLinux权限无法正常启动,建议先关闭 seLinux 调试 ;待上网成功后再处理 seLinux 权限
关闭 seLinux 方法 请参照rk3568 LTE(EC20 ) 移植文档 2.1章节。
k3568 为 64bit CPU, 选用下载 rild 驱动包中 libquectel-ril\arm64-v8a\ 中 libreference-ril.so 拷贝到 device/rockchip/common/4g_modem/lib64/ 并重命名为 libreference-ril.m750.so;
增加 m750 拨号库拷贝命令和依赖库引用信息 device/rockchip/common/device.mk
diff --git a/device.mk b/device.mk
index 406f19b..c1b5dd3 100755
--- a/device.mk
+++ b/device.mk
@@ -274,11 +274,13 @@ PRODUCT_PROPERTY_OVERRIDES += \
ifeq ($(strip $(TARGET_ARCH)), arm64)
PRODUCT_PROPERTY_OVERRIDES += \
- vendor.rild.libpath=/vendor/lib64/librk-ril.so
+ vendor.rild.libargs=-d /dev/ttyUSB2 \
+ vendor.rild.libpath=/vendor/lib64/hw/libreference-ril.m750.so
PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/4g_modem/bin64/dhcpcd:$(TARGET_COPY_OUT_VENDOR)/bin/dhcpcd \
- $(LOCAL_PATH)/4g_modem/lib64/librk-ril.so:$(TARGET_COPY_OUT_VENDOR)/lib64/librk-ril.so
+ $(LOCAL_PATH)/4g_modem/lib64/librk-ril.so:$(TARGET_COPY_OUT_VENDOR)/lib64/librk-ril.so \
+ $(LOCAL_PATH)/4g_modem/lib64/libreference-ril.m750.so:$(TARGET_COPY_OUT_VENDOR)/lib64/hw/libreference-ril.m750.so
else
maniest 增加 HAL 属性信息
device/rockchip/common/4g_modem/manifest.xml
diff --git a/4g_modem/manifest.xml b/4g_modem/manifest.xml
index 9a19b3c..8c93c6b 100644
--- a/4g_modem/manifest.xml
+++ b/4g_modem/manifest.xml
@@ -2,6 +2,11 @@
<hal format="hidl">
<name>android.hardware.radio</name>
<transport>hwbinder</transport>
+ <version>1.0</version>
+ <interface>
+ <name>IRadio</name>
+ <instance>slot1</instance>
+ </interface>
<fqname>@1.1::IRadio/slot1</fqname>
<fqname>@1.1::IRadio/slot2</fqname>
<fqname>@1.2::ISap/slot1</fqname>
开启4G 模组相关平台宏定义
device/rockchip/rk356x/rk3566_r/BoardConfig.mk
BoardConfig.mk:18:BOARD_HAS_RK_4G_MODEM := true
rk3568 工具保存在 vendor/rockchip/common/phone 目录中为防止拨号工具不兼容单独增加目录存储 m750 的相关工具。
rk3568 为 64bit CPU, 选用下载 rild 驱动包中 libquectel-ril\arm64-v8a\ 中 ip-up, ip-down, chat 文件,放到 vendor/rockchip/common/phone/etc/ppp64/m750 (m750 须手动创建)。
diff --git a/phone/phone.mk b/phone/phone.mk
index 285d016c..010f87b3 100755
--- a/phone/phone.mk
+++ b/phone/phone.mk
@@ -6,13 +6,13 @@ CUR_PATH := vendor/rockchip/common
#########################################################
ifeq ($(strip $(TARGET_ARCH)), arm64)
PRODUCT_COPY_FILES += \
- $(CUR_PATH)/phone/etc/ppp64/ip-down:system/etc/ppp/ip-down \
- $(CUR_PATH)/phone/etc/ppp64/ip-up:system/etc/ppp/ip-up \
+ $(CUR_PATH)/phone/etc/ppp64/m750/ip-down:system/etc/ppp/ip-down \
+ $(CUR_PATH)/phone/etc/ppp64/m750/ip-up:system/etc/ppp/ip-up \
$(CUR_PATH)/phone/etc/ppp/call-pppd:system/etc/ppp/call-pppd \
$(CUR_PATH)/phone/etc/operator_table:system/etc/operator_table \
- $(CUR_PATH)/phone/etc/ppp64/ip-down:system/bin/ip-down \
- $(CUR_PATH)/phone/etc/ppp64/ip-up:system/bin/ip-up \
- $(CUR_PATH)/phone/etc/ppp64/chat:system/bin/chat
+ $(CUR_PATH)/phone/etc/ppp64/m750/ip-down:system/bin/ip-down \
+ $(CUR_PATH)/phone/etc/ppp64/m750/ip-up:system/bin/ip-up \
+ $(CUR_PATH)/phone/etc/ppp64/m750/chat:system/bin/chat
else
PRODUCT_COPY_FILES += \
$(CUR_PATH)/phone/etc/ppp/ip-down:system/etc/ppp/ip-down \
增加 4G modem 网络配置,否则看不到 SIM 卡图标和信号指示。可参照 rk3568 LTE (EC20) 2.4 小节 配置如下路径文件
device/rockchip/rk356x/overlay/frameworks/base/core/res/res/values/config.xml
查看 LTE 模组运行状态。如果可以看到基带版本和 SIM卡类型,证明驱动和 libreference 库正常加载。
adb root;adb shell
getprop | grep gsm
[gsm.current.phone-type]: [1]
[gsm.module]: [MG_SLM750]
[gsm.network.type]: [Unknown]
[gsm.operator.alpha]: []
[gsm.operator.iso-country]: []
[gsm.operator.isroaming]: [false]
[gsm.operator.numeric]: []
[gsm.sim.state]: [ABSENT]
[gsm.version.baseband]: [MG_SLM750-V_EQ101_00B.B8E980.B8A1B0_210521_400_C00_V22]
[gsm.version.ril-impl]: [MEIG_RIL_Android7.x-later-V4.9.7.7]
如果看到 rild 服务正常运行但是无法联网,请从以下三点排查问题:
a) 4G 模组是否安装天线,天线是否松动
b) 安装的 SIM 是否欠费
c) APNS.xml 拨号配置文件是否正常
d) 当前环境是否有强信号屏蔽,对比手机信号即可排查问题
getprop | grep ril
[gsm.version.ril-impl]: [MEIG_RIL_Android7.x-later-V4.9.7.7]
[init.svc.vendor.ril-daemon]: [running]
[init.svc_debug_pid.vendor.ril-daemon]: [912]
[persist.vendor.ril.gps.enable]: [true]
[ril.function.dataonly]: [1]
[ro.boot.noril]: [false]
[ro.boottime.vendor.ril-daemon]: [4665505471]
[vendor.rild.libargs]: [-d]
[vendor.rild.libpath]: [/vendor/lib64/hw/libreference-ril.m750.so]
如果 rild 服务显示 stopped;可能因 selinux 权限问题,手动关闭 selinux 再重启 rild
可正常联网;原因定位到 缺少 selinux 权限,后面文章会讲 selinux 权限配置
。
stop vendor.ril-daemon #关闭 rild
start vendor.ril-daemon #开启 rild
有前车之鉴,方能平稳过渡。