xf.li | 9870024 | 2025-03-14 02:20:00 -0700 | [diff] [blame^] | 1 | From 6b423c71c98d90471eb2a34f1dd8217a6bad3510 Mon Sep 17 00:00:00 2001 |
| 2 | From: xf.li <xf.li@mobiletek.cn> |
| 3 | Date: Fri, 14 Mar 2025 00:07:42 -0700 |
| 4 | Subject: [PATCH] [Feature][T106_eSDK]update from T106-V2.01.01.02P56U09.AP.17.09_CAP.17.09.01 to T106-M42-PLXXXX-P56U11.AP.19.00_CAP.19.00.01 -- code |
| 5 | |
| 6 | Only Configure: No |
| 7 | Affected branch: master |
| 8 | Affected module: unknow |
| 9 | Is it affected on both ZXIC and MTK: only ZXIC |
| 10 | Self-test: Yes |
| 11 | Doc Update: No |
| 12 | |
| 13 | Change-Id: I5eb7f586f78a987785b0f9885f1300c42bfd6819 |
| 14 | --- |
| 15 | |
| 16 | diff --git a/esdk/layers/meta-zxic-custom/conf/distro/include/nand-config-default.inc b/esdk/layers/meta-zxic-custom/conf/distro/include/nand-config-default.inc |
| 17 | index 439b293..fe9fc43 100755 |
| 18 | --- a/esdk/layers/meta-zxic-custom/conf/distro/include/nand-config-default.inc |
| 19 | +++ b/esdk/layers/meta-zxic-custom/conf/distro/include/nand-config-default.inc |
| 20 | @@ -2,9 +2,19 @@ |
| 21 | ERASEBLOCK = "0x40000" |
| 22 | UBI_LEB_SIZE = "253952" |
| 23 | UBI_IMAGE_SEQ = "1024" |
| 24 | - |
| 25 | +#LYNQ_MODIFY_ZXW_TASK944_XF.Li_20250123_START |
| 26 | +LYNQ_M22_PAGESIZE = "0x800" |
| 27 | +LYNQ_M22_ERASEBLOCK = "0x20000" |
| 28 | +LYNQ_M22_UBI_LEB_SIZE = "126976" |
| 29 | +#LYNQ_MODIFY_ZXW_TASK944_XF.Li_20250123_END |
| 30 | #rootfs ubiåæ°é
ç½® |
| 31 | #MKUBIFS_ARGS = "-m ${PAGESIZE} -e ${UBI_LEB_SIZE} -c 122 -x zlib -F" |
| 32 | UBINIZE_ARGS = "-m ${PAGESIZE} -p ${ERASEBLOCK} -s ${PAGESIZE} -Q ${UBI_IMAGE_SEQ}" |
| 33 | +#LYNQ_MODIFY_ZXW_TASK944_XF.Li_20250123_START |
| 34 | +LYNQ_M22_UBINIZE_ARGS = "-m ${LYNQ_M22_PAGESIZE} -p ${LYNQ_M22_ERASEBLOCK} -s ${LYNQ_M22_PAGESIZE} -Q ${UBI_IMAGE_SEQ}" |
| 35 | +#LYNQ_MODIFY_ZXW_TASK944_XF.Li_20250123_END |
| 36 | #userdata ubiåæ°é
ç½® |
| 37 | USERDATA_UBINIZE_ARGS = "${UBINIZE_ARGS}" |
| 38 | +#LYNQ_MODIFY_ZXW_TASK944_XF.Li_20250123_START |
| 39 | +LYNQ_M22_USERDATA_UBINIZE_ARGS = "${LYNQ_M22_UBINIZE_ARGS}" |
| 40 | +#LYNQ_MODIFY_ZXW_TASK944_XF.Li_20250123_END |
| 41 | diff --git a/esdk/layers/meta-zxic-custom/conf/distro/vehicle_dc_ref.conf b/esdk/layers/meta-zxic-custom/conf/distro/vehicle_dc_ref.conf |
| 42 | index 50c2f6e..231b4a1 100755 |
| 43 | --- a/esdk/layers/meta-zxic-custom/conf/distro/vehicle_dc_ref.conf |
| 44 | +++ b/esdk/layers/meta-zxic-custom/conf/distro/vehicle_dc_ref.conf |
| 45 | @@ -51,7 +51,9 @@ |
| 46 | |
| 47 | # storage type: nand or emmc |
| 48 | STRORAGE_TYPE = "nand" |
| 49 | -STRORAGE_CONF = "nand-config-4k" |
| 50 | +#LYNQ_MODIFY_ZXW_TASK944_XF.Li_20250123_START |
| 51 | +STRORAGE_CONF = "nand-config-default" |
| 52 | +#LYNQ_MODIFY_ZXW_TASK944_XF.Li_20250123_END |
| 53 | require conf/distro/include/${STRORAGE_CONF}.inc |
| 54 | |
| 55 | #rootfsæä»¶ç³»ç»ç±»å |
| 56 | @@ -467,6 +469,9 @@ |
| 57 | #xf.li@20240716 add for MOBILETEK_LOG_ENCRYPT value: "enable","disable" |
| 58 | MOBILETEK_LOG_ENCRYPT = "disable" |
| 59 | |
| 60 | +#xf.li@20250123 add for M22 SDK value (support M22 or not): "M22", "default" |
| 61 | +MOBILETEK_NAND_TYPE = "M22" |
| 62 | + |
| 63 | LYNQ_CONFIG_COMMITID = "e2a3410390ff0ad762462ccb6af8faa5e16dcd61" |
| 64 | -LYNQ_CONFIG_VERSION = "T106-V2.01.01.02P56U09.AP.17.09_CAP.17.09.01" |
| 65 | -LYNQ_CONFIG_SW_VERSION = "T106-V2.01.01.02P56U09.AP.17.09_CAP.17.09.01" |
| 66 | +LYNQ_CONFIG_VERSION = "T106-M42-PLXXXX-P56U11.AP.19.00_CAP.19.00.01" |
| 67 | +LYNQ_CONFIG_SW_VERSION = "T106-MXX-PLXXXX-P56U11.AP.19.00_CAP.19.00" |
| 68 | diff --git a/esdk/layers/meta-zxic-custom/conf/lynq_base.conf b/esdk/layers/meta-zxic-custom/conf/lynq_base.conf |
| 69 | index 8126a9e..73d9856 100755 |
| 70 | --- a/esdk/layers/meta-zxic-custom/conf/lynq_base.conf |
| 71 | +++ b/esdk/layers/meta-zxic-custom/conf/lynq_base.conf |
| 72 | @@ -67,6 +67,6 @@ |
| 73 | #OEMAPP_CFG value:"PLATFORM","GSW" |
| 74 | MOBILETEK_OEMAPP_CFG = "PLATFORM" |
| 75 | |
| 76 | -LYNQ_CONFIG_COMMITID = "db2a7e1b3aa519b00153f78dcb223c2eb539f891" |
| 77 | -LYNQ_CONFIG_VERSION = "T106-V2.01.01.02P56U09.AP.17.09_CAP.17.09.01" |
| 78 | -LYNQ_CONFIG_SW_VERSION = "T106-V2.01.01.02P56U09.AP.17.09_CAP.17.09.01" |
| 79 | +LYNQ_CONFIG_COMMITID = "7b4d681bdad8b0a31c564ea665a424b81038791a" |
| 80 | +LYNQ_CONFIG_VERSION = "T106-M42-PLXXXX-P56U11.AP.19.00_CAP.19.00.01" |
| 81 | +LYNQ_CONFIG_SW_VERSION = "T106-MXX-PLXXXX-P56U11.AP.19.00_CAP.19.00" |
| 82 | diff --git a/esdk/layers/meta-zxic-custom/recipes-core/busybox/busybox/vehicle_dc-normal-busybox.cfg b/esdk/layers/meta-zxic-custom/recipes-core/busybox/busybox/vehicle_dc-normal-busybox.cfg |
| 83 | index 2b48930..34e65ab 100755 |
| 84 | --- a/esdk/layers/meta-zxic-custom/recipes-core/busybox/busybox/vehicle_dc-normal-busybox.cfg |
| 85 | +++ b/esdk/layers/meta-zxic-custom/recipes-core/busybox/busybox/vehicle_dc-normal-busybox.cfg |
| 86 | @@ -50,7 +50,7 @@ |
| 87 | CONFIG_SYSROOT="" |
| 88 | CONFIG_EXTRA_CFLAGS="" |
| 89 | CONFIG_EXTRA_LDFLAGS="" |
| 90 | -CONFIG_EXTRA_LDLIBS="-lnvram" |
| 91 | +CONFIG_EXTRA_LDLIBS="-lnvram -ldebug_info" |
| 92 | |
| 93 | # |
| 94 | # Installation Options ("make install" behavior) |
| 95 | diff --git a/esdk/layers/meta-zxic-custom/recipes-core/busybox/busybox/vehicle_dc_4Gb-normal-busybox.cfg b/esdk/layers/meta-zxic-custom/recipes-core/busybox/busybox/vehicle_dc_4Gb-normal-busybox.cfg |
| 96 | index 2b48930..34e65ab 100755 |
| 97 | --- a/esdk/layers/meta-zxic-custom/recipes-core/busybox/busybox/vehicle_dc_4Gb-normal-busybox.cfg |
| 98 | +++ b/esdk/layers/meta-zxic-custom/recipes-core/busybox/busybox/vehicle_dc_4Gb-normal-busybox.cfg |
| 99 | @@ -50,7 +50,7 @@ |
| 100 | CONFIG_SYSROOT="" |
| 101 | CONFIG_EXTRA_CFLAGS="" |
| 102 | CONFIG_EXTRA_LDFLAGS="" |
| 103 | -CONFIG_EXTRA_LDLIBS="-lnvram" |
| 104 | +CONFIG_EXTRA_LDLIBS="-lnvram -ldebug_info" |
| 105 | |
| 106 | # |
| 107 | # Installation Options ("make install" behavior) |
| 108 | diff --git a/esdk/layers/meta-zxic-custom/recipes-core/busybox/busybox/vehicle_dc_ref-normal-busybox.cfg b/esdk/layers/meta-zxic-custom/recipes-core/busybox/busybox/vehicle_dc_ref-normal-busybox.cfg |
| 109 | index 2b48930..34e65ab 100755 |
| 110 | --- a/esdk/layers/meta-zxic-custom/recipes-core/busybox/busybox/vehicle_dc_ref-normal-busybox.cfg |
| 111 | +++ b/esdk/layers/meta-zxic-custom/recipes-core/busybox/busybox/vehicle_dc_ref-normal-busybox.cfg |
| 112 | @@ -50,7 +50,7 @@ |
| 113 | CONFIG_SYSROOT="" |
| 114 | CONFIG_EXTRA_CFLAGS="" |
| 115 | CONFIG_EXTRA_LDFLAGS="" |
| 116 | -CONFIG_EXTRA_LDLIBS="-lnvram" |
| 117 | +CONFIG_EXTRA_LDLIBS="-lnvram -ldebug_info" |
| 118 | |
| 119 | # |
| 120 | # Installation Options ("make install" behavior) |
| 121 | diff --git a/esdk/layers/meta-zxic-custom/recipes-core/busybox/busybox/vehicle_dc_systemd-normal-busybox.cfg b/esdk/layers/meta-zxic-custom/recipes-core/busybox/busybox/vehicle_dc_systemd-normal-busybox.cfg |
| 122 | index 5d7d82f..bd0c63c 100755 |
| 123 | --- a/esdk/layers/meta-zxic-custom/recipes-core/busybox/busybox/vehicle_dc_systemd-normal-busybox.cfg |
| 124 | +++ b/esdk/layers/meta-zxic-custom/recipes-core/busybox/busybox/vehicle_dc_systemd-normal-busybox.cfg |
| 125 | @@ -50,7 +50,7 @@ |
| 126 | CONFIG_SYSROOT="" |
| 127 | CONFIG_EXTRA_CFLAGS="" |
| 128 | CONFIG_EXTRA_LDFLAGS="" |
| 129 | -CONFIG_EXTRA_LDLIBS="-lnvram" |
| 130 | +CONFIG_EXTRA_LDLIBS="-lnvram -ldebug_info" |
| 131 | |
| 132 | # |
| 133 | # Installation Options ("make install" behavior) |
| 134 | diff --git a/esdk/layers/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc/fs/normal/rootfs/etc_ro/default/default_parameter_user b/esdk/layers/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc/fs/normal/rootfs/etc_ro/default/default_parameter_user |
| 135 | index 5234be8..7570274 100755 |
| 136 | --- a/esdk/layers/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc/fs/normal/rootfs/etc_ro/default/default_parameter_user |
| 137 | +++ b/esdk/layers/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc/fs/normal/rootfs/etc_ro/default/default_parameter_user |
| 138 | @@ -500,4 +500,5 @@ |
| 139 | telog_path= |
| 140 | zpsstate_detect=1 |
| 141 | zpsstate_detect_period=60 |
| 142 | -zpsstate_restart=0 |
| 143 | \ No newline at end of file |
| 144 | +zpsstate_restart=0 |
| 145 | +ap_reset_app=default |
| 146 | diff --git a/esdk/layers/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_4Gb/fs/normal/rootfs/etc_ro/default/default_parameter_user b/esdk/layers/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_4Gb/fs/normal/rootfs/etc_ro/default/default_parameter_user |
| 147 | index 7147993..63f20d3 100755 |
| 148 | --- a/esdk/layers/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_4Gb/fs/normal/rootfs/etc_ro/default/default_parameter_user |
| 149 | +++ b/esdk/layers/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_4Gb/fs/normal/rootfs/etc_ro/default/default_parameter_user |
| 150 | @@ -499,4 +499,5 @@ |
| 151 | telog_path= |
| 152 | zpsstate_detect=1 |
| 153 | zpsstate_detect_period=60 |
| 154 | -zpsstate_restart=0 |
| 155 | \ No newline at end of file |
| 156 | +zpsstate_restart=0 |
| 157 | +ap_reset_app=default |
| 158 | diff --git a/esdk/layers/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_ref/fs/normal/rootfs/etc_ro/default/default_parameter_user b/esdk/layers/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_ref/fs/normal/rootfs/etc_ro/default/default_parameter_user |
| 159 | index f082891..f7695af 100755 |
| 160 | --- a/esdk/layers/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_ref/fs/normal/rootfs/etc_ro/default/default_parameter_user |
| 161 | +++ b/esdk/layers/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_ref/fs/normal/rootfs/etc_ro/default/default_parameter_user |
| 162 | @@ -551,4 +551,5 @@ |
| 163 | telog_path= |
| 164 | zpsstate_detect=1 |
| 165 | zpsstate_detect_period=60 |
| 166 | -zpsstate_restart=0 |
| 167 | \ No newline at end of file |
| 168 | +zpsstate_restart=0 |
| 169 | +ap_reset_app=default |
| 170 | diff --git a/esdk/layers/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_systemd/fs/normal/rootfs/etc_ro/default/default_parameter_user b/esdk/layers/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_systemd/fs/normal/rootfs/etc_ro/default/default_parameter_user |
| 171 | index 92191d4..4c1dd17 100755 |
| 172 | --- a/esdk/layers/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_systemd/fs/normal/rootfs/etc_ro/default/default_parameter_user |
| 173 | +++ b/esdk/layers/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_systemd/fs/normal/rootfs/etc_ro/default/default_parameter_user |
| 174 | @@ -495,3 +495,4 @@ |
| 175 | xlat_enable=1 |
| 176 | telog_path_cap= |
| 177 | telog_path= |
| 178 | +ap_reset_app=default |
| 179 | diff --git a/esdk/layers/meta-zxic-custom/recipes-core/images/zxic-image.bb b/esdk/layers/meta-zxic-custom/recipes-core/images/zxic-image.bb |
| 180 | index b86b882..1a77daa 100755 |
| 181 | --- a/esdk/layers/meta-zxic-custom/recipes-core/images/zxic-image.bb |
| 182 | +++ b/esdk/layers/meta-zxic-custom/recipes-core/images/zxic-image.bb |
| 183 | @@ -147,6 +147,11 @@ |
| 184 | cp -arfp ${BSPDIR}/sources/meta-zxic-custom/conf/distro/include/${USERDATA_UBINIZE_CFG} ${B} |
| 185 | mkdir -p ${BINS-PATH} |
| 186 | ${B}/ubinize-cfg.sh "${BINS-PATH}/${USEDATA_FS_NAME}" "${B}/${USERDATA_UBINIZE_CFG}" "${USERDATA_UBINIZE_ARGS}" |
| 187 | +#LYNQ_MODIFY_ZXW_TASK944_XF.Li_20250123_START |
| 188 | +if ${@bb.utils.contains('MOBILETEK_NAND_TYPE','M22','true','false',d)}; then |
| 189 | + ${B}/ubinize-cfg.sh "${BINS-PATH}/ap_capuserdata_M22.img" "${B}/${USERDATA_UBINIZE_CFG}" "${LYNQ_M22_USERDATA_UBINIZE_ARGS}" |
| 190 | +fi |
| 191 | +#LYNQ_MODIFY_ZXW_TASK944_XF.Li_20250123_END |
| 192 | mkdir -p ${IMAGE_ROOTFS}/etc_ro/ |
| 193 | cp -v "${BINS-PATH}/${USEDATA_FS_NAME}" ${IMAGE_ROOTFS}/etc_ro/ |
| 194 | fi |
| 195 | @@ -207,6 +212,11 @@ |
| 196 | cp -arfp ${BSPDIR}/sources/meta-zxic-custom/conf/distro/include/${OEMDATA_UBINIZE_CFG} ${B} |
| 197 | mkdir -p ${BINS-PATH} |
| 198 | ${B}/ubinize-cfg.sh "${BINS-PATH}/${OEMDATA_FS_NAME}" "${B}/${OEMDATA_UBINIZE_CFG}" "${USERDATA_UBINIZE_ARGS}" |
| 199 | +#LYNQ_MODIFY_ZXW_TASK944_XF.Li_20250123_START |
| 200 | +if ${@bb.utils.contains('MOBILETEK_NAND_TYPE','M22','true','false',d)}; then |
| 201 | + ${B}/ubinize-cfg.sh "${BINS-PATH}/cap_oemdata_M22.img" "${B}/${OEMDATA_UBINIZE_CFG}" "${LYNQ_M22_USERDATA_UBINIZE_ARGS}" |
| 202 | +fi |
| 203 | +#LYNQ_MODIFY_ZXW_TASK944_XF.Li_20250123_END |
| 204 | mkdir -p ${IMAGE_ROOTFS}/etc_ro/ |
| 205 | cp -v "${BINS-PATH}/${OEMDATA_FS_NAME}" ${IMAGE_ROOTFS}/etc_ro/ |
| 206 | fi |
| 207 | @@ -234,12 +244,21 @@ |
| 208 | ${S}/squashfs_dm-verity.sh ${S}/${ROOT_FS_NAME}.unsigned ${S} \ |
| 209 | ${BINS-PATH}/ap_caprootfs.img.dm ${SIGNIMAGE_PRIVATE_KEY} ${BSPDIR}/tools/SignTool/SignImage |
| 210 | ${S}/ubinize-static.sh vol_rootfs "${BINS-PATH}/ap_caprootfs.img" ${BINS-PATH}/ap_caprootfs.img.dm "${UBINIZE_ARGS}" |
| 211 | - |
| 212 | +#LYNQ_MODIFY_ZXW_TASK944_XF.Li_20250123_START |
| 213 | +if ${@bb.utils.contains('MOBILETEK_NAND_TYPE','M22','true','false',d)}; then |
| 214 | + ${S}/ubinize-static.sh vol_rootfs "${BINS-PATH}/ap_caprootfs_M22.img" ${BINS-PATH}/ap_caprootfs.img.dm "${LYNQ_M22_UBINIZE_ARGS}" |
| 215 | +fi |
| 216 | +#LYNQ_MODIFY_ZXW_TASK944_XF.Li_20250123_END |
| 217 | if ${@bb.utils.contains('DISTRO_FEATURES','oemfs','true','false',d)}; then |
| 218 | rm -fv ${BINS-PATH}/cap_oem.img.dm |
| 219 | ${B}/squashfs_dm-verity.sh ${S}/cap_oem.img.unsigned ${B} \ |
| 220 | ${BINS-PATH}/cap_oem.img.dm ${SIGNIMAGE_PRIVATE_KEY} ${BSPDIR}/tools/SignTool/SignImage |
| 221 | ${B}/ubinize-static.sh vol_oem "${BINS-PATH}/cap_oem.img" ${BINS-PATH}/cap_oem.img.dm "${UBINIZE_ARGS}" |
| 222 | +#LYNQ_MODIFY_ZXW_TASK944_XF.Li_20250123_START |
| 223 | +if ${@bb.utils.contains('MOBILETEK_NAND_TYPE','M22','true','false',d)}; then |
| 224 | + ${B}/ubinize-static.sh vol_oem "${BINS-PATH}/cap_oem_M22.img" ${BINS-PATH}/cap_oem.img.dm "${LYNQ_M22_UBINIZE_ARGS}" |
| 225 | +fi |
| 226 | +#LYNQ_MODIFY_ZXW_TASK944_XF.Li_20250123_END |
| 227 | fi |
| 228 | fi |
| 229 | } |
| 230 | @@ -258,6 +277,8 @@ |
| 231 | " |
| 232 | #xf.li@20240716 add start |
| 233 | do_oem_config() { |
| 234 | + LYNQ_INSIDE_VERSION_UCI=" option LYNQ_SW_INSIDE_VERSION '${LYNQ_CONFIG_VERSION}'" |
| 235 | + eval sed -i 's/^.*LYNQ_SW_INSIDE_VERSION.*$/"${LYNQ_INSIDE_VERSION_UCI}"/' ${IMAGE_ROOTFS}/etc/config/lynq_uci_ro |
| 236 | cp -R ${TOPDIR}/prebuilt/rootfs/* ${IMAGE_ROOTFS}/ |
| 237 | if [ "${MOBILETEK_LOG_ENCRYPT}" = "enable" ]; then |
| 238 | touch ${IMAGE_ROOTFS}/etc/syslog_encrypt_flag |
| 239 | diff --git a/esdk/layers/meta-zxic-custom/recipes-lynq/liblynq-sim/liblynq-sim.bb b/esdk/layers/meta-zxic-custom/recipes-lynq/liblynq-sim/liblynq-sim.bb |
| 240 | index 7b8ff1d..65d5358 100755 |
| 241 | --- a/esdk/layers/meta-zxic-custom/recipes-lynq/liblynq-sim/liblynq-sim.bb |
| 242 | +++ b/esdk/layers/meta-zxic-custom/recipes-lynq/liblynq-sim/liblynq-sim.bb |
| 243 | @@ -3,7 +3,7 @@ |
| 244 | DESCRIPTION = "lynq sim" |
| 245 | LICENSE = "CLOSED" |
| 246 | LIC_FILES_CHKSUM = "file://LICENSE;md5=e1696b147d49d491bcb4da1a57173fff" |
| 247 | -DEPENDS += "libpal gstreamer1.0 glib-2.0 libapn liblynq-log libvendor-ril liblynq-shm libbinder" |
| 248 | +DEPENDS += "libpal gstreamer1.0 glib-2.0 libapn liblynq-log libvendor-ril liblynq-shm libbinder liblynq-uci libsctel" |
| 249 | #inherit workonsrc |
| 250 | WORKONSRC = "${TOPDIR}/../src/lynq/lib/liblynq-sim/" |
| 251 | FILESEXTRAPATHS_prepend :="${TOPDIR}/../src/lynq/lib/:" |
| 252 | diff --git a/esdk/layers/meta-zxic-custom/recipes-lynq/libpoweralarm/libpoweralarm.bb b/esdk/layers/meta-zxic-custom/recipes-lynq/libpoweralarm/libpoweralarm.bb |
| 253 | index aeecf6e..c709cf9 100755 |
| 254 | --- a/esdk/layers/meta-zxic-custom/recipes-lynq/libpoweralarm/libpoweralarm.bb |
| 255 | +++ b/esdk/layers/meta-zxic-custom/recipes-lynq/libpoweralarm/libpoweralarm.bb |
| 256 | @@ -4,7 +4,7 @@ |
| 257 | #LICENSE = "Mobiletek"" |
| 258 | LICENSE = "CLOSED" |
| 259 | LIC_FILES_CHKSUM = "file://LICENSE;md5=d759532d295a4ec07250edf931caef80" |
| 260 | -DEPENDS += "bootchart liblynq-log libsctel libscrtc" |
| 261 | +DEPENDS += "bootchart liblynq-log libsctel libscrtc libsoftap" |
| 262 | |
| 263 | #inherit workonsrc |
| 264 | WORKONSRC = "${TOPDIR}/../src/lynq/lib/libpoweralarm/" |
| 265 | diff --git a/esdk/layers/meta-zxic-custom/recipes-lynq/lynq-qser-network-demo/files/lynq_qser_network.h b/esdk/layers/meta-zxic-custom/recipes-lynq/lynq-qser-network-demo/files/lynq_qser_network.h |
| 266 | index aee4285..a6c8e15 100755 |
| 267 | --- a/esdk/layers/meta-zxic-custom/recipes-lynq/lynq-qser-network-demo/files/lynq_qser_network.h |
| 268 | +++ b/esdk/layers/meta-zxic-custom/recipes-lynq/lynq-qser-network-demo/files/lynq_qser_network.h |
| 269 | @@ -42,23 +42,25 @@ |
| 270 | }E_QSER_NW_IMS_MODE_TYPE_T; |
| 271 | |
| 272 | /** Configures the OOS (out of service) settings that define the MCM network interface. */ |
| 273 | -#define QSER_NW_OOS_CFG_TYPE_FAST_SCAN 0x00 /**< fast net scan */ |
| 274 | -#define QSER_NW_OOS_CFG_TYPE_FULL_BAND_SCAN 0x01 /**< full band scan */ |
| 275 | +#define QSER_NW_OOS_CFG_TYPE_FAST_SCAN 0x00 /**< fast net scan, only for normal mode */ |
| 276 | +#define QSER_NW_OOS_CFG_TYPE_FULL_BAND_SCAN 0x01 /**< full band scan, only for low power mode */ |
| 277 | |
| 278 | typedef struct |
| 279 | { |
| 280 | - /* Configuration parameters for MCM network fast network scan when OOS (out of service)*/ |
| 281 | - char enable; |
| 282 | - uint16_t time_interval; |
| 283 | + /* Configuration parameters for MCM network fast network scan when OOS (out of service) in normal mode*/ |
| 284 | + char enable; /*[0, 1]*/ |
| 285 | + uint16_t time_interval; /*[1, 65535],unit: second, valid when enable equal 1*/ |
| 286 | }QSER_NW_OOS_CONFIG_FAST_SCAN_INFO_T; |
| 287 | |
| 288 | typedef struct |
| 289 | { |
| 290 | - /* Configuration parameters for MCM network full band network scan when OOS (out of service)*/ |
| 291 | - int t_min; |
| 292 | - int t_step; |
| 293 | - int t_num; |
| 294 | - int t_max; |
| 295 | + /* Configuration parameters for MCM network full band network scan when OOS (out of service) in low power mode*/ |
| 296 | + /*t_min,t_step,t_num,t_max all are 0, or all are not 0*/ |
| 297 | + /*if t_min > t_max, time interval will be t_max*/ |
| 298 | + int t_min; /*[0, 65535], unit: second*/ |
| 299 | + int t_step; /*[0, 65535], unit: second*/ |
| 300 | + int t_num; /*[0, 65535]*/ |
| 301 | + int t_max; /*[0, 65535], unit: second*/ |
| 302 | }QSER_NW_OOS_CONFIG_FULL_BAND_SCAN_INFO_T; |
| 303 | |
| 304 | |
| 305 | diff --git a/esdk/layers/meta-zxic-custom/recipes-lynq/lynq-qser-voice-demo/files/lynq-qser-voice-demo.cpp b/esdk/layers/meta-zxic-custom/recipes-lynq/lynq-qser-voice-demo/files/lynq-qser-voice-demo.cpp |
| 306 | index e7eebc3..e9730f1 100755 |
| 307 | --- a/esdk/layers/meta-zxic-custom/recipes-lynq/lynq-qser-voice-demo/files/lynq-qser-voice-demo.cpp |
| 308 | +++ b/esdk/layers/meta-zxic-custom/recipes-lynq/lynq-qser-voice-demo/files/lynq-qser-voice-demo.cpp |
| 309 | @@ -31,6 +31,8 @@ |
| 310 | #endif
|
| 311 | {9, "qser_voice_set_audio_mode"},
|
| 312 | {10, "qser_voice_get_audio_mode"},
|
| 313 | + {11, "qser_voice_set_mic_volume"},
|
| 314 | + {12, "qser_voice_get_mic_volume"},
|
| 315 | {-1, NULL}
|
| 316 | };
|
| 317 |
|
| 318 | @@ -56,6 +58,9 @@ |
| 319 | int (*qser_voice_set_audio_mode)(const int audio_mode);
|
| 320 | int (*qser_voice_get_audio_mode)(int* audio_mode);
|
| 321 |
|
| 322 | +int (*qser_voice_set_mic_volume)(const int volume);
|
| 323 | +int (*qser_voice_get_mic_volume)(int *volume);
|
| 324 | +
|
| 325 |
|
| 326 | #ifdef ECALL_SUPPORT
|
| 327 | int (*qser_voice_set_test_num)(voice_client_handle_type* h_voice,E_QSER_VOICE_ECALL_SET_TYPE_T type, const char *test_num, int test_num_length);
|
| 328 | @@ -252,6 +257,19 @@ |
| 329 | printf("qser_voice_get_audio_mode not defined or exported in %s\n", lynqLibPath_Call);
|
| 330 | return -1;
|
| 331 | }
|
| 332 | + qser_voice_set_mic_volume = (int (*)(const int ))dlsym(dlHandle_call,"qser_voice_set_mic_volume");
|
| 333 | + if(qser_voice_set_mic_volume == NULL)
|
| 334 | + {
|
| 335 | + printf("qser_voice_set_mic_volume not defined or exported in %s\n", lynqLibPath_Call);
|
| 336 | + return -1;
|
| 337 | + }
|
| 338 | +
|
| 339 | + qser_voice_get_mic_volume = (int (*)(int* ))dlsym(dlHandle_call,"qser_voice_get_mic_volume");
|
| 340 | + if(qser_voice_get_mic_volume == NULL)
|
| 341 | + {
|
| 342 | + printf("qser_voice_get_mic_volume not defined or exported in %s\n", lynqLibPath_Call);
|
| 343 | + return -1;
|
| 344 | + }
|
| 345 |
|
| 346 |
|
| 347 | ret = qser_voice_call_client_init(&h_voice);
|
| 348 | @@ -419,7 +437,25 @@ |
| 349 | printf("qser_voice_get_audio_mode ret = %d, audio_mode is %d\n", ret, audio_mode);
|
| 350 | break;
|
| 351 | }
|
| 352 | + case 11:
|
| 353 | + {
|
| 354 | + int volume = 0;
|
| 355 | + printf("Please set mic volume:0-5 level\n");
|
| 356 | + scanf("%d",&volume);
|
| 357 | + ret = qser_voice_set_mic_volume(volume);
|
| 358 | + printf("ret is %d\n",ret);
|
| 359 | + break;
|
| 360 |
|
| 361 | + }
|
| 362 | +
|
| 363 | + case 12:
|
| 364 | + {
|
| 365 | + int volume = -1;
|
| 366 | + printf("Enter get mic volume\n");
|
| 367 | + ret = qser_voice_get_mic_volume(&volume);
|
| 368 | + printf("ret is %d,get volume is %d\n",ret,volume);
|
| 369 | + break;
|
| 370 | + }
|
| 371 | default:
|
| 372 | print_help();
|
| 373 | break;
|
| 374 | diff --git a/esdk/layers/meta-zxic-custom/recipes-lynq/lynq-vb-demo/files/lynq_vb_demo.c b/esdk/layers/meta-zxic-custom/recipes-lynq/lynq-vb-demo/files/lynq_vb_demo.c |
| 375 | index fc94d2a..a3e6499 100755 |
| 376 | --- a/esdk/layers/meta-zxic-custom/recipes-lynq/lynq-vb-demo/files/lynq_vb_demo.c |
| 377 | +++ b/esdk/layers/meta-zxic-custom/recipes-lynq/lynq-vb-demo/files/lynq_vb_demo.c |
| 378 | @@ -14,12 +14,17 @@ |
| 379 | #include <semaphore.h>
|
| 380 | #include <sys/types.h>
|
| 381 | #include <pthread.h>
|
| 382 | +#include <log/log.h>
|
| 383 | +#include <time.h>
|
| 384 | +#define LOG_TAG "VB_DEMO"
|
| 385 | +
|
| 386 | +
|
| 387 |
|
| 388 | /*command max len*/
|
| 389 | #define VOICE_CMD_MAX_LEN 64
|
| 390 |
|
| 391 | -#define EXIT_CMD_STOP "stop\n"
|
| 392 | -#define EXIT_CMD_Q "q\n"
|
| 393 | +#define EXIT_CMD_STOP "stop\n"
|
| 394 | +#define EXIT_CMD_Q "q\n"
|
| 395 | #define EXIT_CMD_EXIT "exit\n"
|
| 396 |
|
| 397 | #define REQ_VOICE_BUFFER_TEST_START "voice_buffer_test_start"
|
| 398 | @@ -38,7 +43,7 @@ |
| 399 |
|
| 400 |
|
| 401 |
|
| 402 | -#define VB_MAX_INT 0x7fffffff
|
| 403 | +#define VB_MAX_INT 0x7fffffff
|
| 404 | #define VB_MIN_INT 0
|
| 405 | #define VB_INT_OVERFLOW(x) if((x < VB_MIN_INT)||(x > VB_MAX_INT)) x = 0;
|
| 406 |
|
| 407 | @@ -49,21 +54,21 @@ |
| 408 | typedef int (vb_thread_proc)(void*);
|
| 409 | struct vbuf_info_t
|
| 410 | {
|
| 411 | - int fd;
|
| 412 | - pthread_t rx_test_thread;
|
| 413 | - pthread_t tx_test_thread;
|
| 414 | - pthread_t loop_test_thread;
|
| 415 | - int quit;
|
| 416 | - char *tx_buf;
|
| 417 | - char *rx_buf;
|
| 418 | - int buf_size;
|
| 419 | - char *tx_filename;
|
| 420 | - char *rx_filename;
|
| 421 | + int fd;
|
| 422 | + pthread_t rx_test_thread;
|
| 423 | + pthread_t tx_test_thread;
|
| 424 | + pthread_t loop_test_thread;
|
| 425 | + int quit;
|
| 426 | + char *tx_buf;
|
| 427 | + char *rx_buf;
|
| 428 | + int buf_size;
|
| 429 | + char *tx_filename;
|
| 430 | + char *rx_filename;
|
| 431 | FILE *tx_file;
|
| 432 | - FILE *rx_file;
|
| 433 | + FILE *rx_file;
|
| 434 | int tx_filesize;
|
| 435 | - int rx_filesize;
|
| 436 | - int fs;
|
| 437 | + int rx_filesize;
|
| 438 | + int fs;
|
| 439 | };
|
| 440 |
|
| 441 | static struct vbuf_info_t vbuf_rec;
|
| 442 | @@ -74,40 +79,47 @@ |
| 443 |
|
| 444 | printf("voice_buffer_test_start value: 8000,16000\n");
|
| 445 | printf("voice_buffer_test_stop no value input\n");
|
| 446 | - printf("voice_buffer_loop_test_start value: 8000,16000\n");
|
| 447 | + printf("voice_buffer_loop_test_start value: 8000,16000\n");
|
| 448 | printf("voice_buffer_loop_test_stop no value input\n");
|
| 449 | printf("\n");
|
| 450 | }
|
| 451 |
|
| 452 | static int vbuffer_start_flag = 0;
|
| 453 | static int tx_optcount = 0;
|
| 454 | -static int rx_optcount = 0;
|
| 455 | +static int rx_optcount = 0;
|
| 456 | static int first_rderr_flag = 0;
|
| 457 | static int first_wrerr_flag = 0;
|
| 458 |
|
| 459 | +static pthread_mutex_t s_vb_demo_mtx = PTHREAD_MUTEX_INITIALIZER;
|
| 460 | +
|
| 461 | static int vb_close_fd_release_buf()
|
| 462 | -{
|
| 463 | - int ret = voice_buffer_close(vbuf_rec.fd);
|
| 464 | - if(ret != 0)
|
| 465 | +{
|
| 466 | + int ret=0;
|
| 467 | + if(vbuf_rec.fd>0)
|
| 468 | {
|
| 469 | - printf("%s : vb close fail \n",__func__);
|
| 470 | + ret = voice_buffer_close(vbuf_rec.fd);
|
| 471 | + if(ret != 0)
|
| 472 | + {
|
| 473 | + RLOGE("%s : vb close fail ret is %d\n",__func__,ret);
|
| 474 | + }
|
| 475 | + vbuf_rec.fd = -1;
|
| 476 | }
|
| 477 | - vbuf_rec.fd = -1;
|
| 478 | +
|
| 479 |
|
| 480 | if(vbuf_rec.rx_buf)
|
| 481 | {
|
| 482 | - free(vbuf_rec.rx_buf);
|
| 483 | - vbuf_rec.rx_buf = NULL;
|
| 484 | + free(vbuf_rec.rx_buf);
|
| 485 | + vbuf_rec.rx_buf = NULL;
|
| 486 | }
|
| 487 |
|
| 488 | if(vbuf_rec.tx_buf)
|
| 489 | {
|
| 490 | free(vbuf_rec.tx_buf);
|
| 491 | - vbuf_rec.tx_buf = NULL;
|
| 492 | + vbuf_rec.tx_buf = NULL;
|
| 493 | }
|
| 494 |
|
| 495 | - vbuffer_start_flag = 0;
|
| 496 | - printf("close buf fd and release buf end\n");
|
| 497 | + vbuffer_start_flag = 0;
|
| 498 | + RLOGD("close buf fd and release buf end\n");
|
| 499 | return ret;
|
| 500 | }
|
| 501 |
|
| 502 | @@ -124,56 +136,56 @@ |
| 503 | int r_size;
|
| 504 |
|
| 505 |
|
| 506 | - printf( "%s: start size=%d! \n",__func__,size);
|
| 507 | + RLOGD( "%s: start size=%d! \n",__func__,size);
|
| 508 | memset (buf,0, size);
|
| 509 |
|
| 510 | while (!vbuf_rec.quit)
|
| 511 | {
|
| 512 | - rx_optcount ++;
|
| 513 | - VB_INT_OVERFLOW(rx_optcount);
|
| 514 | - if((rx_optcount%1000) == 0){
|
| 515 | - printf("%s: rx_optcount=%d! \n",__func__,rx_optcount);
|
| 516 | + rx_optcount ++;
|
| 517 | + VB_INT_OVERFLOW(rx_optcount);
|
| 518 | + if((rx_optcount%1000) == 0){
|
| 519 | + RLOGD("%s: rx_optcount=%d! \n",__func__,rx_optcount);
|
| 520 |
|
| 521 | - }
|
| 522 | - else if(rx_optcount == 1000000){
|
| 523 | - printf("%s: rx_optcount=%d! \n",__func__,rx_optcount);
|
| 524 | - rx_optcount = 0;
|
| 525 | -
|
| 526 | - }
|
| 527 | + }
|
| 528 | + else if(rx_optcount == 1000000){
|
| 529 | + RLOGD("%s: rx_optcount=%d! \n",__func__,rx_optcount);
|
| 530 | + rx_optcount = 0;
|
| 531 | +
|
| 532 | + }
|
| 533 |
|
| 534 | //read form ps
|
| 535 | - r_size = voice_buffer_read(vbuf_rec.fd, buf, size);
|
| 536 | + r_size = voice_buffer_read(vbuf_rec.fd, buf, size);
|
| 537 | if(r_size <= 0)
|
| 538 | {
|
| 539 | - first_rderr_flag++;
|
| 540 | - VB_INT_OVERFLOW(first_rderr_flag);
|
| 541 | + first_rderr_flag++;
|
| 542 | + VB_INT_OVERFLOW(first_rderr_flag);
|
| 543 | continue ;
|
| 544 | }
|
| 545 | - else{
|
| 546 | - first_rderr_flag = 0;
|
| 547 | + else{
|
| 548 | + first_rderr_flag = 0;
|
| 549 |
|
| 550 | - }
|
| 551 | -
|
| 552 | + }
|
| 553 | +
|
| 554 | if(vbuf_rec.rx_file != NULL)
|
| 555 | {
|
| 556 | - r_size = fwrite(buf, 1,size, vbuf_rec.rx_file);
|
| 557 | + r_size = fwrite(buf, 1,size, vbuf_rec.rx_file);
|
| 558 |
|
| 559 | - if (r_size != size) {
|
| 560 | - //printf("Error fwrite size not eq,r_size=%d,size=%d\n",r_size,size);
|
| 561 | - }
|
| 562 | - else{
|
| 563 | -
|
| 564 | - bytes_read += size;
|
| 565 | - if(bytes_read >= vbuf_rec.rx_filesize){
|
| 566 | - fseek(vbuf_rec.rx_file, 0, SEEK_SET);
|
| 567 | - bytes_read = 0;
|
| 568 | - printf("fwrite over write maxsize(%d)!!!\n",vbuf_rec.rx_filesize);
|
| 569 | -
|
| 570 | - }
|
| 571 | - }
|
| 572 | + if (r_size != size) {
|
| 573 | + //printf("Error fwrite size not eq,r_size=%d,size=%d\n",r_size,size);
|
| 574 | + }
|
| 575 | + else{
|
| 576 | +
|
| 577 | + bytes_read += size;
|
| 578 | + if(bytes_read >= vbuf_rec.rx_filesize){
|
| 579 | + fseek(vbuf_rec.rx_file, 0, SEEK_SET);
|
| 580 | + bytes_read = 0;
|
| 581 | + RLOGD("fwrite over write maxsize(%d)!!!\n",vbuf_rec.rx_filesize);
|
| 582 | +
|
| 583 | + }
|
| 584 | + }
|
| 585 | }
|
| 586 | -
|
| 587 | -
|
| 588 | +
|
| 589 | +
|
| 590 | }
|
| 591 |
|
| 592 | return 0;
|
| 593 | @@ -184,65 +196,65 @@ |
| 594 | int ret;
|
| 595 | int num_read;
|
| 596 |
|
| 597 | -
|
| 598 | +
|
| 599 | char* buf = vbuf_rec.tx_buf;
|
| 600 | -
|
| 601 | +
|
| 602 | int size = vbuf_rec.buf_size;
|
| 603 | int w_size;
|
| 604 |
|
| 605 | - printf("%s: start size=%d! \n",__func__,size);
|
| 606 | + RLOGD("%s: start size=%d! \n",__func__,size);
|
| 607 |
|
| 608 | -
|
| 609 | +
|
| 610 | memset(buf, 0,size);
|
| 611 | while (!vbuf_rec.quit)
|
| 612 | {
|
| 613 |
|
| 614 | - if(vbuf_rec.tx_file != NULL)
|
| 615 | - {
|
| 616 | + if(vbuf_rec.tx_file != NULL)
|
| 617 | + {
|
| 618 |
|
| 619 | - num_read = fread(buf,1,size, vbuf_rec.tx_file);
|
| 620 | -
|
| 621 | - if (num_read != size) {
|
| 622 | - //printf("Error fread size not eq,num_read=%d,size=%d\n",num_read,size);
|
| 623 | - }
|
| 624 | - if (num_read <= 0) {
|
| 625 | - printf("Error fread size not eq,num_read=%d,size=%d\n",num_read,size);
|
| 626 | - fseek(vbuf_rec.tx_file, 0, SEEK_SET);
|
| 627 | - }
|
| 628 | - }
|
| 629 | - tx_optcount ++;
|
| 630 | - VB_INT_OVERFLOW(tx_optcount);
|
| 631 | -
|
| 632 | - w_size = voice_buffer_write(vbuf_rec.fd, buf, size);
|
| 633 | + num_read = fread(buf,1,size, vbuf_rec.tx_file);
|
| 634 | +
|
| 635 | + if (num_read != size) {
|
| 636 | + //printf("Error fread size not eq,num_read=%d,size=%d\n",num_read,size);
|
| 637 | + }
|
| 638 | + if (num_read <= 0) {
|
| 639 | + RLOGD("Error fread size not eq,num_read=%d,size=%d\n",num_read,size);
|
| 640 | + fseek(vbuf_rec.tx_file, 0, SEEK_SET);
|
| 641 | + }
|
| 642 | + }
|
| 643 | + tx_optcount ++;
|
| 644 | + VB_INT_OVERFLOW(tx_optcount);
|
| 645 | +
|
| 646 | + w_size = voice_buffer_write(vbuf_rec.fd, buf, size);
|
| 647 | if(w_size <= 0)
|
| 648 | {
|
| 649 | - first_wrerr_flag++;
|
| 650 | -
|
| 651 | - VB_INT_OVERFLOW(first_wrerr_flag);
|
| 652 | -
|
| 653 | + first_wrerr_flag++;
|
| 654 | +
|
| 655 | + VB_INT_OVERFLOW(first_wrerr_flag);
|
| 656 | +
|
| 657 | continue;
|
| 658 | }
|
| 659 | - else{
|
| 660 | - first_wrerr_flag = 0;
|
| 661 | + else{
|
| 662 | + first_wrerr_flag = 0;
|
| 663 |
|
| 664 | - }
|
| 665 | + }
|
| 666 |
|
| 667 | }
|
| 668 | return 0;
|
| 669 | }
|
| 670 |
|
| 671 |
|
| 672 | -static int vb_thread_create( const char *name,pthread_t *thread_t, vb_thread_proc *proc,
|
| 673 | - int stack_size, unsigned priority,void *arg )
|
| 674 | +static int vb_thread_create( const char *name,pthread_t *thread_t, vb_thread_proc *proc,
|
| 675 | + int stack_size, unsigned priority,void *arg )
|
| 676 | {
|
| 677 | pthread_attr_t thread_attr;
|
| 678 | int ret;
|
| 679 | - int default_size;
|
| 680 | + int default_size;
|
| 681 |
|
| 682 | struct sched_param param;
|
| 683 | int policy = SCHED_FIFO;
|
| 684 |
|
| 685 | - printf("%s: start! \n",__func__);
|
| 686 | + RLOGD("%s: start! \n",__func__);
|
| 687 |
|
| 688 | /* Init thread attributes */
|
| 689 | pthread_attr_init(&thread_attr);
|
| 690 | @@ -251,18 +263,18 @@ |
| 691 | ret = pthread_create( thread_t, &thread_attr,proc, arg);
|
| 692 | if (ret != 0)
|
| 693 | {
|
| 694 | - printf("%s: pthread_create fail,ret=%d! \n",__func__,ret);
|
| 695 | + RLOGE("%s: pthread_create fail,ret=%d! \n",__func__,ret);
|
| 696 |
|
| 697 | - pthread_attr_destroy(&thread_attr);
|
| 698 | + pthread_attr_destroy(&thread_attr);
|
| 699 | return ret;
|
| 700 | }
|
| 701 | -
|
| 702 | +
|
| 703 | pthread_attr_getstacksize(&thread_attr, &default_size);
|
| 704 | - printf("%s: pthread_attr_getstacksize(%d)! \n",__func__,default_size);
|
| 705 | + RLOGD("%s: pthread_attr_getstacksize(%d)! \n",__func__,default_size);
|
| 706 |
|
| 707 | pthread_attr_destroy(&thread_attr);
|
| 708 | -
|
| 709 | - printf("%s: end \n",__func__);
|
| 710 | +
|
| 711 | + RLOGD("%s: end \n",__func__);
|
| 712 | return 0;
|
| 713 | }
|
| 714 |
|
| 715 | @@ -273,136 +285,136 @@ |
| 716 | {
|
| 717 | int ret = 0;
|
| 718 | int buf_size = 320;
|
| 719 | - tx_optcount = 0;
|
| 720 | - rx_optcount = 0;
|
| 721 | + tx_optcount = 0;
|
| 722 | + rx_optcount = 0;
|
| 723 | int* buf_int;
|
| 724 |
|
| 725 | - int i;
|
| 726 | + int i;
|
| 727 |
|
| 728 | - if(vbuffer_start_flag == 1){
|
| 729 | - printf(" VB already start,return \n");
|
| 730 | + if(vbuffer_start_flag == 1){
|
| 731 | + RLOGE(" VB already start,return \n");
|
| 732 |
|
| 733 | - return 0;
|
| 734 | - }
|
| 735 | + return 0;
|
| 736 | + }
|
| 737 |
|
| 738 | - vbuffer_start_flag = 1;
|
| 739 | + vbuffer_start_flag = 1;
|
| 740 |
|
| 741 |
|
| 742 |
|
| 743 | - if((vbuf_rec.fd != -1)&&(vbuf_rec.fd != 0)){
|
| 744 | - printf(" VB fd already get, vbuf_rec.fd=%d return \n",vbuf_rec.fd);
|
| 745 | - }
|
| 746 | + if((vbuf_rec.fd != -1)&&(vbuf_rec.fd != 0)){
|
| 747 | + RLOGE(" VB fd already get, vbuf_rec.fd=%d return \n",vbuf_rec.fd);
|
| 748 | + }
|
| 749 |
|
| 750 | - if(fs == 8000){
|
| 751 | + if(fs == 8000){
|
| 752 |
|
| 753 | - buf_size = 320;
|
| 754 | - }
|
| 755 | - else if(fs == 16000){
|
| 756 | + buf_size = 320;
|
| 757 | + }
|
| 758 | + else if(fs == 16000){
|
| 759 |
|
| 760 | - buf_size = 640;
|
| 761 | - }
|
| 762 | - else
|
| 763 | - {
|
| 764 | - buf_size = 320;
|
| 765 | - }
|
| 766 | - printf("Starting vb stream fs=%d buf_size=%d \n",fs,buf_size);
|
| 767 | + buf_size = 640;
|
| 768 | + }
|
| 769 | + else
|
| 770 | + {
|
| 771 | + buf_size = 320;
|
| 772 | + }
|
| 773 | + RLOGD("Starting vb stream fs=%d buf_size=%d \n",fs,buf_size);
|
| 774 |
|
| 775 | - printf("%s:open tx and rx file \n",__func__);
|
| 776 | - if(fs == 8000){
|
| 777 | + RLOGD("%s:open tx and rx file \n",__func__);
|
| 778 | + if(fs == 8000){
|
| 779 |
|
| 780 | - vbuf_rec.tx_filename = VBUFFER_TX_FILE_NAME;//"/cache/tx.pcm";
|
| 781 | - vbuf_rec.rx_filename = VBUFFER_RX_FILE_NAME;//"/cache/rx.pcm";
|
| 782 | + vbuf_rec.tx_filename = VBUFFER_TX_FILE_NAME;//"/cache/tx.pcm";
|
| 783 | + vbuf_rec.rx_filename = VBUFFER_RX_FILE_NAME;//"/cache/rx.pcm";
|
| 784 |
|
| 785 | - }
|
| 786 | - else if(fs == 16000){
|
| 787 | + }
|
| 788 | + else if(fs == 16000){
|
| 789 |
|
| 790 | - vbuf_rec.tx_filename = VBUFFER_TX16_FILE_NAME;//"/cache/tx16.pcm";
|
| 791 | - vbuf_rec.rx_filename = VBUFFER_RX16_FILE_NAME;//"/cache/rx16.pcm";
|
| 792 | + vbuf_rec.tx_filename = VBUFFER_TX16_FILE_NAME;//"/cache/tx16.pcm";
|
| 793 | + vbuf_rec.rx_filename = VBUFFER_RX16_FILE_NAME;//"/cache/rx16.pcm";
|
| 794 |
|
| 795 | - }
|
| 796 | - else
|
| 797 | - {
|
| 798 | - vbuf_rec.tx_filename = VBUFFER_TX_FILE_NAME;//"/cache/tx.pcm";
|
| 799 | - vbuf_rec.rx_filename = VBUFFER_RX_FILE_NAME;//"/cache/rx.pcm";
|
| 800 | + }
|
| 801 | + else
|
| 802 | + {
|
| 803 | + vbuf_rec.tx_filename = VBUFFER_TX_FILE_NAME;//"/cache/tx.pcm";
|
| 804 | + vbuf_rec.rx_filename = VBUFFER_RX_FILE_NAME;//"/cache/rx.pcm";
|
| 805 |
|
| 806 | - }
|
| 807 | + }
|
| 808 |
|
| 809 |
|
| 810 |
|
| 811 | -
|
| 812 | +
|
| 813 | vbuf_rec.tx_file = fopen(vbuf_rec.tx_filename , "rb");
|
| 814 | if (!vbuf_rec.tx_file) {
|
| 815 | - printf("Unable to open file '%s'\n", vbuf_rec.tx_filename);
|
| 816 | + RLOGE("Unable to open file '%s'\n", vbuf_rec.tx_filename);
|
| 817 | //return -1;
|
| 818 | }
|
| 819 |
|
| 820 |
|
| 821 | vbuf_rec.rx_file = fopen(vbuf_rec.rx_filename, "wb");
|
| 822 | if (!vbuf_rec.rx_file) {
|
| 823 | - printf(stderr, "Unable to create file '%s'\n", vbuf_rec.rx_filename);
|
| 824 | - //fclose(vbuf_rec.tx_file);
|
| 825 | + RLOGE("Unable to create file '%s'\n", vbuf_rec.rx_filename);
|
| 826 | + //fclose(vbuf_rec.tx_file);
|
| 827 |
|
| 828 | //return -1;
|
| 829 | }
|
| 830 | - vbuf_rec.rx_filesize = RX_FILE_LEN_MAX;
|
| 831 | - printf("%s : vbuf_rec.rx_filesize(%d) \n",__func__,vbuf_rec.rx_filesize);
|
| 832 | + vbuf_rec.rx_filesize = RX_FILE_LEN_MAX;
|
| 833 | + RLOGD("%s : vbuf_rec.rx_filesize(%d) \n",__func__,vbuf_rec.rx_filesize);
|
| 834 |
|
| 835 | vbuf_rec.rx_buf = (char*) malloc(buf_size);
|
| 836 | - if(!vbuf_rec.rx_buf) {
|
| 837 | - printf("%s : malloc buf fail,return \n",__func__);
|
| 838 | - goto err;
|
| 839 | - }
|
| 840 | + if(!vbuf_rec.rx_buf) {
|
| 841 | + RLOGE("%s : malloc buf fail,return \n",__func__);
|
| 842 | + goto err;
|
| 843 | + }
|
| 844 | vbuf_rec.tx_buf = (char*) malloc(buf_size);
|
| 845 | - if(!vbuf_rec.tx_buf) {
|
| 846 | - free(vbuf_rec.rx_buf);
|
| 847 | - printf("%s : malloc buf fail,return \n",__func__);
|
| 848 | - vbuf_rec.rx_buf = NULL;
|
| 849 | - goto err;
|
| 850 | - }
|
| 851 | - vbuf_rec.buf_size = buf_size;
|
| 852 | -
|
| 853 | + if(!vbuf_rec.tx_buf) {
|
| 854 | + free(vbuf_rec.rx_buf);
|
| 855 | + RLOGE("%s : malloc buf fail,return \n",__func__);
|
| 856 | + vbuf_rec.rx_buf = NULL;
|
| 857 | + goto err;
|
| 858 | + }
|
| 859 | + vbuf_rec.buf_size = buf_size;
|
| 860 | +
|
| 861 | vbuf_rec.quit = 0;
|
| 862 | -
|
| 863 | - printf("%s : vb open start \n",__func__);
|
| 864 | +
|
| 865 | + RLOGD("%s : vb open start \n",__func__);
|
| 866 |
|
| 867 | -
|
| 868 | +
|
| 869 | vbuf_rec.fd = voice_buffer_open();
|
| 870 | - if(vbuf_rec.fd <= 0){
|
| 871 | - printf("%s : vb open fail fd=%d,return \n",__func__,vbuf_rec.fd);
|
| 872 | - ret = -1;
|
| 873 | - goto err;
|
| 874 | -
|
| 875 | - }
|
| 876 | - printf("%s :voice_buffer_open end \n",__func__);
|
| 877 | -
|
| 878 | - printf("%s :rx tx vb_thread_create start \n",__func__);
|
| 879 | + if(vbuf_rec.fd <= 0){
|
| 880 | + RLOGE("%s : vb open fail fd=%d,return \n",__func__,vbuf_rec.fd);
|
| 881 | + ret = -1;
|
| 882 | + goto err;
|
| 883 | +
|
| 884 | + }
|
| 885 | + RLOGD("%s :voice_buffer_open end \n",__func__);
|
| 886 | +
|
| 887 | + RLOGD("%s :rx tx vb_thread_create start \n",__func__);
|
| 888 | ret = vb_thread_create ("vb_playback_test",&vbuf_rec.rx_test_thread, vb_rx_test_thread_func,
|
| 889 | - 4*1024,35,NULL);
|
| 890 | + 4*1024,35,NULL);
|
| 891 | if (ret != 0)
|
| 892 | {
|
| 893 | - printf("%s :rx vb_thread_create fail ret=%d,return \n",__func__,ret);
|
| 894 | + RLOGE("%s :rx vb_thread_create fail ret=%d,return \n",__func__,ret);
|
| 895 | vbuf_rec.rx_test_thread = NULL;
|
| 896 | - goto err;
|
| 897 | + goto err;
|
| 898 | }
|
| 899 |
|
| 900 | - printf("%s :rx vb_thread_create end \n",__func__);
|
| 901 | + RLOGD("%s :rx vb_thread_create end \n",__func__);
|
| 902 |
|
| 903 | ret = vb_thread_create ( "vbuf_record_test", &vbuf_rec.tx_test_thread, vb_tx_test_thread_func,
|
| 904 | - 4*1024,35,NULL);
|
| 905 | + 4*1024,35,NULL);
|
| 906 | if (ret != 0)
|
| 907 | {
|
| 908 |
|
| 909 | - printf("%s :tx vb_thread_create fail ret=%d,return \n",__func__,ret);
|
| 910 | + RLOGE("%s :tx vb_thread_create fail ret=%d,return \n",__func__,ret);
|
| 911 | vbuf_rec.tx_test_thread = NULL;
|
| 912 | - goto err;
|
| 913 | + goto err;
|
| 914 | }
|
| 915 | - printf("%s :tx vb_thread_create end \n",__func__);
|
| 916 | + RLOGD("%s :tx vb_thread_create end \n",__func__);
|
| 917 |
|
| 918 | return 0;
|
| 919 |
|
| 920 | err:
|
| 921 | voice_buffer_stream_test_stop();
|
| 922 | -
|
| 923 | +
|
| 924 | return ret;
|
| 925 | }
|
| 926 |
|
| 927 | @@ -411,42 +423,42 @@ |
| 928 | int voice_buffer_stream_test_stop(void)
|
| 929 | {
|
| 930 | int ret = 0;
|
| 931 | - printf("%s:rx tx thread exit start \n",__func__);
|
| 932 | - if(vbuf_rec.quit == 1) {
|
| 933 | - printf("%s,already stop ,return\n",__func__);
|
| 934 | + RLOGD("%s:rx tx thread exit start \n",__func__);
|
| 935 | + if(vbuf_rec.quit == 1) {
|
| 936 | + RLOGD("%s,already stop ,return\n",__func__);
|
| 937 |
|
| 938 | - }
|
| 939 | + }
|
| 940 |
|
| 941 | vbuf_rec.quit = 1;
|
| 942 | - voice_buffer_stop(vbuf_rec.fd);
|
| 943 | + voice_buffer_stop(vbuf_rec.fd);
|
| 944 | if (vbuf_rec.tx_test_thread)
|
| 945 | {
|
| 946 | pthread_join (vbuf_rec.tx_test_thread,NULL);
|
| 947 | vbuf_rec.tx_test_thread = NULL;
|
| 948 | -
|
| 949 | +
|
| 950 | }
|
| 951 |
|
| 952 | if (vbuf_rec.rx_test_thread)
|
| 953 | - {
|
| 954 | + {
|
| 955 | pthread_join (vbuf_rec.rx_test_thread,NULL);
|
| 956 | vbuf_rec.rx_test_thread = NULL;
|
| 957 | }
|
| 958 | -
|
| 959 | - if(vbuf_rec.tx_file != NULL)
|
| 960 | - {
|
| 961 | - fclose(vbuf_rec.tx_file);
|
| 962 | - printf("%s : vb close ,close tx file \n",__func__);
|
| 963 | - vbuf_rec.tx_file = NULL;
|
| 964 | - }
|
| 965 | -
|
| 966 | - if(vbuf_rec.rx_file != NULL)
|
| 967 | - {
|
| 968 | +
|
| 969 | + if(vbuf_rec.tx_file != NULL)
|
| 970 | + {
|
| 971 | + fclose(vbuf_rec.tx_file);
|
| 972 | + RLOGD("%s : vb close ,close tx file \n",__func__);
|
| 973 | + vbuf_rec.tx_file = NULL;
|
| 974 | + }
|
| 975 | +
|
| 976 | + if(vbuf_rec.rx_file != NULL)
|
| 977 | + {
|
| 978 |
|
| 979 | - fclose(vbuf_rec.rx_file);
|
| 980 | - printf("%s : vb close ,close rx file \n",__func__);
|
| 981 | - vbuf_rec.rx_file = NULL;
|
| 982 | -
|
| 983 | - }
|
| 984 | + fclose(vbuf_rec.rx_file);
|
| 985 | + RLOGD("%s : vb close ,close rx file \n",__func__);
|
| 986 | + vbuf_rec.rx_file = NULL;
|
| 987 | +
|
| 988 | + }
|
| 989 |
|
| 990 | vb_close_fd_release_buf();
|
| 991 | return 0;
|
| 992 | @@ -460,55 +472,55 @@ |
| 993 | char* buf = vbuf_rec.rx_buf;
|
| 994 | int size = vbuf_rec.buf_size;
|
| 995 |
|
| 996 | - //char* buf = vbuf_rec.tx_buf;
|
| 997 | -
|
| 998 | + //char* buf = vbuf_rec.tx_buf;
|
| 999 | +
|
| 1000 | //int size = vbuf_rec.buf_size;
|
| 1001 | int w_size;
|
| 1002 | int r_size;
|
| 1003 |
|
| 1004 |
|
| 1005 | - printf( "%s: start size=%d! \n",__func__,size);
|
| 1006 | + RLOGD( "%s: start size=%d! \n",__func__,size);
|
| 1007 | memset (buf,0, size);
|
| 1008 |
|
| 1009 | while (!vbuf_rec.quit)
|
| 1010 | {
|
| 1011 | - rx_optcount ++;
|
| 1012 | - VB_INT_OVERFLOW(rx_optcount);
|
| 1013 | - if((rx_optcount%1000) == 0){
|
| 1014 | - printf("%s: rx_optcount=%d! \n",__func__,rx_optcount);
|
| 1015 | + rx_optcount ++;
|
| 1016 | + VB_INT_OVERFLOW(rx_optcount);
|
| 1017 | + if((rx_optcount%1000) == 0){
|
| 1018 | + RLOGD("%s: rx_optcount=%d! \n",__func__,rx_optcount);
|
| 1019 |
|
| 1020 | - }
|
| 1021 | - else if(rx_optcount == 1000000){
|
| 1022 | - printf("%s: rx_optcount=%d! \n",__func__,rx_optcount);
|
| 1023 | - rx_optcount = 0;
|
| 1024 | -
|
| 1025 | - }
|
| 1026 | + }
|
| 1027 | + else if(rx_optcount == 1000000){
|
| 1028 | + RLOGD("%s: rx_optcount=%d! \n",__func__,rx_optcount);
|
| 1029 | + rx_optcount = 0;
|
| 1030 | +
|
| 1031 | + }
|
| 1032 |
|
| 1033 | //read form ps
|
| 1034 | - r_size = voice_buffer_read(vbuf_rec.fd, vbuf_rec.rx_buf, size);
|
| 1035 | + r_size = voice_buffer_read(vbuf_rec.fd, vbuf_rec.rx_buf, size);
|
| 1036 | if(r_size <= 0)
|
| 1037 | {
|
| 1038 | - first_rderr_flag++;
|
| 1039 | - VB_INT_OVERFLOW(first_rderr_flag);
|
| 1040 | + first_rderr_flag++;
|
| 1041 | + VB_INT_OVERFLOW(first_rderr_flag);
|
| 1042 | continue ;
|
| 1043 | }
|
| 1044 | - else{
|
| 1045 | - first_rderr_flag = 0;
|
| 1046 | - }
|
| 1047 | + else{
|
| 1048 | + first_rderr_flag = 0;
|
| 1049 | + }
|
| 1050 | memcpy(vbuf_rec.tx_buf,vbuf_rec.rx_buf,size);
|
| 1051 | - w_size = voice_buffer_write(vbuf_rec.fd, vbuf_rec.tx_buf, size);
|
| 1052 | + w_size = voice_buffer_write(vbuf_rec.fd, vbuf_rec.tx_buf, size);
|
| 1053 | if(w_size <= 0)
|
| 1054 | {
|
| 1055 | - first_wrerr_flag++;
|
| 1056 | -
|
| 1057 | - VB_INT_OVERFLOW(first_wrerr_flag);
|
| 1058 | -
|
| 1059 | + first_wrerr_flag++;
|
| 1060 | +
|
| 1061 | + VB_INT_OVERFLOW(first_wrerr_flag);
|
| 1062 | +
|
| 1063 | continue;
|
| 1064 | }
|
| 1065 | - else{
|
| 1066 | - first_wrerr_flag = 0;
|
| 1067 | - }
|
| 1068 | -
|
| 1069 | + else{
|
| 1070 | + first_wrerr_flag = 0;
|
| 1071 | + }
|
| 1072 | +
|
| 1073 | }
|
| 1074 |
|
| 1075 | return 0;
|
| 1076 | @@ -521,98 +533,98 @@ |
| 1077 | {
|
| 1078 | int ret = -1;
|
| 1079 | int buf_size = 320;
|
| 1080 | - tx_optcount = 0;
|
| 1081 | - rx_optcount = 0;
|
| 1082 | + tx_optcount = 0;
|
| 1083 | + rx_optcount = 0;
|
| 1084 | int* buf_int;
|
| 1085 |
|
| 1086 | - int i;
|
| 1087 | + int i;
|
| 1088 |
|
| 1089 | - if(vbuffer_start_flag == 1){
|
| 1090 | - printf(" VB already start,return \n");
|
| 1091 | + if(vbuffer_start_flag == 1){
|
| 1092 | + RLOGE(" VB already start,return \n");
|
| 1093 |
|
| 1094 | - return 0;
|
| 1095 | - }
|
| 1096 | -
|
| 1097 | - if((vbuf_rec.fd != -1)&&(vbuf_rec.fd != 0)){
|
| 1098 | - printf(" VB fd already get, vbuf_rec.fd=%d return \n",vbuf_rec.fd);
|
| 1099 | - }
|
| 1100 | -
|
| 1101 | - vbuffer_start_flag = 1;
|
| 1102 | -
|
| 1103 | - if(fs == 8000){
|
| 1104 | -
|
| 1105 | - buf_size = 320;
|
| 1106 | - }
|
| 1107 | - else if(fs == 16000){
|
| 1108 | -
|
| 1109 | - buf_size = 640;
|
| 1110 | - }
|
| 1111 | - else
|
| 1112 | - {
|
| 1113 | - buf_size = 320;
|
| 1114 | - }
|
| 1115 | - printf("Starting vb stream fs=%d buf_size=%d \n",fs,buf_size);
|
| 1116 | -
|
| 1117 | - vbuf_rec.rx_buf = (char*) malloc(buf_size);
|
| 1118 | - if(!vbuf_rec.rx_buf) {
|
| 1119 | - printf("%s : malloc buf fail,return \n",__func__);
|
| 1120 | - goto err;
|
| 1121 | - }
|
| 1122 | - vbuf_rec.tx_buf = (char*) malloc(buf_size);
|
| 1123 | - if(!vbuf_rec.tx_buf) {
|
| 1124 | - printf("%s : malloc buf fail,return \n",__func__);
|
| 1125 | - goto err;
|
| 1126 | - }
|
| 1127 | - vbuf_rec.buf_size = buf_size;
|
| 1128 | -
|
| 1129 | - vbuf_rec.quit = 0;
|
| 1130 | -
|
| 1131 | - printf("%s : vb open start \n",__func__);
|
| 1132 | -
|
| 1133 | -
|
| 1134 | - vbuf_rec.fd = voice_buffer_open();
|
| 1135 | - if(vbuf_rec.fd <= 0){
|
| 1136 | - printf("%s : vb open fail fd=%d,return \n",__func__,vbuf_rec.fd);
|
| 1137 | - goto err;
|
| 1138 | -
|
| 1139 | - }
|
| 1140 | - printf("%s :loop vb_thread_create start \n",__func__);
|
| 1141 | - ret = vb_thread_create ("vb_playback_test",&vbuf_rec.loop_test_thread, vb_loop_test_thread_func,
|
| 1142 | - 4*1024,35,NULL);
|
| 1143 | - if (ret != 0)
|
| 1144 | - {
|
| 1145 | - printf("%s :rx vb_thread_create fail ret=%d,return \n",__func__,ret);
|
| 1146 | - goto err;
|
| 1147 | + return 0;
|
| 1148 | }
|
| 1149 |
|
| 1150 | - printf("%s :rx vb_thread_create end \n",__func__);
|
| 1151 | + if((vbuf_rec.fd != -1)&&(vbuf_rec.fd != 0)){
|
| 1152 | + RLOGE(" VB fd already get, vbuf_rec.fd=%d return \n",vbuf_rec.fd);
|
| 1153 | + }
|
| 1154 | +
|
| 1155 | + vbuffer_start_flag = 1;
|
| 1156 | +
|
| 1157 | + if(fs == 8000){
|
| 1158 | +
|
| 1159 | + buf_size = 320;
|
| 1160 | + }
|
| 1161 | + else if(fs == 16000){
|
| 1162 | +
|
| 1163 | + buf_size = 640;
|
| 1164 | + }
|
| 1165 | + else
|
| 1166 | + {
|
| 1167 | + buf_size = 320;
|
| 1168 | + }
|
| 1169 | + RLOGD("Starting vb stream fs=%d buf_size=%d \n",fs,buf_size);
|
| 1170 | +
|
| 1171 | + vbuf_rec.rx_buf = (char*) malloc(buf_size);
|
| 1172 | + if(!vbuf_rec.rx_buf) {
|
| 1173 | + RLOGE("%s : malloc buf fail,return \n",__func__);
|
| 1174 | + goto err;
|
| 1175 | + }
|
| 1176 | + vbuf_rec.tx_buf = (char*) malloc(buf_size);
|
| 1177 | + if(!vbuf_rec.tx_buf) {
|
| 1178 | + RLOGE("%s : malloc buf fail,return \n",__func__);
|
| 1179 | + goto err;
|
| 1180 | + }
|
| 1181 | + vbuf_rec.buf_size = buf_size;
|
| 1182 | +
|
| 1183 | + vbuf_rec.quit = 0;
|
| 1184 | +
|
| 1185 | + RLOGD("%s : vb open start \n",__func__);
|
| 1186 | +
|
| 1187 | +
|
| 1188 | + vbuf_rec.fd = voice_buffer_open();
|
| 1189 | + if(vbuf_rec.fd <= 0){
|
| 1190 | + RLOGE("%s : vb open fail fd=%d,return \n",__func__,vbuf_rec.fd);
|
| 1191 | + goto err;
|
| 1192 | +
|
| 1193 | + }
|
| 1194 | + RLOGD("%s :loop vb_thread_create start \n",__func__);
|
| 1195 | + ret = vb_thread_create ("vb_playback_test",&vbuf_rec.loop_test_thread, vb_loop_test_thread_func,
|
| 1196 | + 4*1024,35,NULL);
|
| 1197 | + if (ret != 0)
|
| 1198 | + {
|
| 1199 | + RLOGE("%s :rx vb_thread_create fail ret=%d,return \n",__func__,ret);
|
| 1200 | + goto err;
|
| 1201 | + }
|
| 1202 | +
|
| 1203 | + RLOGD("%s :rx vb_thread_create end \n",__func__);
|
| 1204 |
|
| 1205 | return 0;
|
| 1206 |
|
| 1207 | err:
|
| 1208 | - voice_buffer_stream_loop_test_stop();
|
| 1209 | -
|
| 1210 | + voice_buffer_stream_loop_test_stop();
|
| 1211 | +
|
| 1212 | return ret;
|
| 1213 | }
|
| 1214 |
|
| 1215 | int voice_buffer_stream_loop_test_stop(void)
|
| 1216 | {
|
| 1217 | int ret = 0;
|
| 1218 | - printf("%s:loop thread exit start \n",__func__);
|
| 1219 | - if(vbuf_rec.quit == 1) {
|
| 1220 | - printf("%s,already stop ,return\n",__func__);
|
| 1221 | + RLOGD("%s:loop thread exit start \n",__func__);
|
| 1222 | + if(vbuf_rec.quit == 1) {
|
| 1223 | + RLOGD("%s,already stop ,return\n",__func__);
|
| 1224 |
|
| 1225 | - }
|
| 1226 | + }
|
| 1227 |
|
| 1228 | vbuf_rec.quit = 1;
|
| 1229 | - voice_buffer_stop(vbuf_rec.fd);
|
| 1230 | + voice_buffer_stop(vbuf_rec.fd);
|
| 1231 | if (vbuf_rec.loop_test_thread)
|
| 1232 | {
|
| 1233 | pthread_join (vbuf_rec.loop_test_thread,NULL);
|
| 1234 | vbuf_rec.tx_test_thread = NULL;
|
| 1235 | -
|
| 1236 | +
|
| 1237 | }
|
| 1238 | -
|
| 1239 | +
|
| 1240 | vb_close_fd_release_buf();
|
| 1241 | return 0;
|
| 1242 | }
|
| 1243 | @@ -635,102 +647,110 @@ |
| 1244 | void voice_buffer_cmd_proc(char *cmdstr)
|
| 1245 | {
|
| 1246 | int ret = 0;
|
| 1247 | - char data[VOICE_CMD_MAX_LEN];
|
| 1248 | - int cmdstr_len = strlen(cmdstr); //-strlen("\r")
|
| 1249 | + char data[VOICE_CMD_MAX_LEN];
|
| 1250 | + int cmdstr_len = strlen(cmdstr); //-strlen("\r")
|
| 1251 | int value = 0;
|
| 1252 | int *p_value = &value;
|
| 1253 | +
|
| 1254 | +
|
| 1255 |
|
| 1256 | cmdstr[cmdstr_len] = '\0'; //+strlen("\0")
|
| 1257 |
|
| 1258 | - ret = sscanf(cmdstr, "%s", data);
|
| 1259 | + ret = sscanf(cmdstr, "%s", data);
|
| 1260 | if(1 != ret){
|
| 1261 | - printf("data sscanf failed!(%d)\n", ret);
|
| 1262 | + RLOGE("data sscanf failed!(%d)\n", ret);
|
| 1263 | return;
|
| 1264 | }
|
| 1265 | - if(0 == strncmp(data, REQ_VOICE_BUFFER_TEST_START, strlen(REQ_VOICE_BUFFER_TEST_START))){
|
| 1266 |
|
| 1267 | - ret = sscanf(cmdstr, "%*s %d", &value);
|
| 1268 | + pthread_mutex_lock(&s_vb_demo_mtx);
|
| 1269 | + if(0 == strncmp(data, REQ_VOICE_BUFFER_TEST_START, strlen(REQ_VOICE_BUFFER_TEST_START))){
|
| 1270 | +
|
| 1271 | + ret = sscanf(cmdstr, "%*s %d", &value);
|
| 1272 | if(1 != ret){
|
| 1273 | - printf("%s,value sscanf failed!(%d)\n",data, ret);
|
| 1274 | - return;
|
| 1275 | + RLOGE("%s,value sscanf failed!(%d)\n",data, ret);
|
| 1276 | + goto vb_cmd_end;
|
| 1277 | }
|
| 1278 | -
|
| 1279 | - printf("%s set value %d\n", data, value);
|
| 1280 | - ret = voice_buffer_stream_test_start(value);
|
| 1281 | +
|
| 1282 | + RLOGD("%s set value %d\n", data, value);
|
| 1283 | + ret = voice_buffer_stream_test_start(value);
|
| 1284 |
|
| 1285 | - printf("%s return ret=%d\n", data, ret);
|
| 1286 | -
|
| 1287 | - }
|
| 1288 | - else if(0 == strncmp(data, REQ_VOICE_BUFFER_TEST_STOP, strlen(REQ_VOICE_BUFFER_TEST_STOP))){
|
| 1289 | - ret = voice_buffer_stream_test_stop();
|
| 1290 | - printf("%s return %d\n", data, ret);
|
| 1291 | - }
|
| 1292 | - else if(0 == strncmp(data, REQ_VOICE_BUFFER_LOOP_TEST_START, strlen(REQ_VOICE_BUFFER_LOOP_TEST_START))){
|
| 1293 | + RLOGD("%s return ret=%d\n", data, ret);
|
| 1294 | +
|
| 1295 | + }
|
| 1296 | + else if(0 == strncmp(data, REQ_VOICE_BUFFER_TEST_STOP, strlen(REQ_VOICE_BUFFER_TEST_STOP))){
|
| 1297 | + ret = voice_buffer_stream_test_stop();
|
| 1298 | + RLOGD("%s return %d\n", data, ret);
|
| 1299 | + }
|
| 1300 | + else if(0 == strncmp(data, REQ_VOICE_BUFFER_LOOP_TEST_START, strlen(REQ_VOICE_BUFFER_LOOP_TEST_START))){
|
| 1301 |
|
| 1302 | - ret = sscanf(cmdstr, "%*s %d", &value);
|
| 1303 | + ret = sscanf(cmdstr, "%*s %d", &value);
|
| 1304 | if(1 != ret){
|
| 1305 | - printf("%s,value sscanf failed!(%d)\n",data, ret);
|
| 1306 | - return;
|
| 1307 | + RLOGE("%s,value sscanf failed!(%d)\n",data, ret);
|
| 1308 | + goto vb_cmd_end;
|
| 1309 | }
|
| 1310 | -
|
| 1311 | - printf("%s set value %d\n", data, value);
|
| 1312 | - ret = voice_buffer_stream_loop_test_start(value);
|
| 1313 | +
|
| 1314 | + RLOGD("%s set value %d\n", data, value);
|
| 1315 | + ret = voice_buffer_stream_loop_test_start(value);
|
| 1316 |
|
| 1317 | - printf("%s return ret=%d\n", data, ret);
|
| 1318 | -
|
| 1319 | - }
|
| 1320 | - else if(0 == strncmp(data, REQ_VOICE_BUFFER_LOOP_TEST_STOP, strlen(REQ_VOICE_BUFFER_LOOP_TEST_STOP))){
|
| 1321 | - printf("voice_buffer_stream_loop_test_stop \n");
|
| 1322 | - ret = voice_buffer_stream_loop_test_stop();
|
| 1323 | - printf("%s return %d\n", data, ret);
|
| 1324 | - }
|
| 1325 | + RLOGD("%s return ret=%d\n", data, ret);
|
| 1326 | +
|
| 1327 | + }
|
| 1328 | + else if(0 == strncmp(data, REQ_VOICE_BUFFER_LOOP_TEST_STOP, strlen(REQ_VOICE_BUFFER_LOOP_TEST_STOP))){
|
| 1329 | + RLOGD("voice_buffer_stream_loop_test_stop \n");
|
| 1330 | + ret = voice_buffer_stream_loop_test_stop();
|
| 1331 | + RLOGD("%s return %d\n", data, ret);
|
| 1332 | + }
|
| 1333 | else if(0 == strncmp(data, REQ_VOICE_BUFFER_RTP_TEST_START, strlen(REQ_VOICE_BUFFER_RTP_TEST_START))){
|
| 1334 |
|
| 1335 | - ret = sscanf(cmdstr, "%*s %d", &value);
|
| 1336 | + ret = sscanf(cmdstr, "%*s %d", &value);
|
| 1337 | if(1 != ret){
|
| 1338 | - printf("%s,value sscanf failed!(%d)\n",data, ret);
|
| 1339 | - return;
|
| 1340 | + RLOGE("%s,value sscanf failed!(%d)\n",data, ret);
|
| 1341 | + goto vb_cmd_end;
|
| 1342 | }
|
| 1343 | -
|
| 1344 | - printf("%s set value %d\n", data, value);
|
| 1345 | - ret = voice_buffer_rtp_test_start(value);
|
| 1346 | +
|
| 1347 | + RLOGD("%s set value %d\n", data, value);
|
| 1348 | + ret = voice_buffer_rtp_test_start(value);
|
| 1349 |
|
| 1350 | - printf("%s return ret=%d\n", data, ret);
|
| 1351 | -
|
| 1352 | - }
|
| 1353 | - else if(0 == strncmp(data, REQ_VOICE_BUFFER_RTP_TEST_STOP, strlen(REQ_VOICE_BUFFER_RTP_TEST_STOP))){
|
| 1354 | - ret = voice_buffer_rtp_test_stop();
|
| 1355 | - printf("%s return %d\n", data, ret);
|
| 1356 | - }
|
| 1357 | + RLOGD("%s return ret=%d\n", data, ret);
|
| 1358 | +
|
| 1359 | + }
|
| 1360 | + else if(0 == strncmp(data, REQ_VOICE_BUFFER_RTP_TEST_STOP, strlen(REQ_VOICE_BUFFER_RTP_TEST_STOP))){
|
| 1361 | + ret = voice_buffer_rtp_test_stop();
|
| 1362 | + RLOGD("%s return %d\n", data, ret);
|
| 1363 | + }
|
| 1364 | else{
|
| 1365 | - printf("Request unknow.\n");
|
| 1366 | + RLOGE("Request unknow.\n");
|
| 1367 | printUsage(cmdstr);
|
| 1368 | - }
|
| 1369 | + }
|
| 1370 | +vb_cmd_end:
|
| 1371 | + pthread_mutex_unlock(&s_vb_demo_mtx);
|
| 1372 | }
|
| 1373 |
|
| 1374 | void vb_buffer_stop_all()
|
| 1375 | {
|
| 1376 | - voice_buffer_stream_loop_test_stop();
|
| 1377 | + voice_buffer_stream_loop_test_stop();
|
| 1378 | voice_buffer_stream_test_stop();
|
| 1379 | voice_buffer_rtp_test_stop();
|
| 1380 | }
|
| 1381 |
|
| 1382 | void signal_handle_func(int sig)
|
| 1383 | {
|
| 1384 | - printf("sig(%d) signal_handle_func exit ",sig);
|
| 1385 | -
|
| 1386 | + RLOGD("sig(%d) signal_handle_func exit ",sig);
|
| 1387 | +
|
| 1388 | + pthread_mutex_lock(&s_vb_demo_mtx);
|
| 1389 | vb_buffer_stop_all();
|
| 1390 | - exit(0);
|
| 1391 | + pthread_mutex_unlock(&s_vb_demo_mtx);
|
| 1392 | + exit(0);
|
| 1393 | }
|
| 1394 |
|
| 1395 | int main(int argc, char **argv)
|
| 1396 | {
|
| 1397 | char cmdstr[VOICE_CMD_MAX_LEN];
|
| 1398 | -
|
| 1399 | - signal(SIGINT, signal_handle_func);
|
| 1400 | - signal(SIGQUIT, signal_handle_func);
|
| 1401 | - signal(SIGTERM, signal_handle_func);
|
| 1402 | - signal(SIGPIPE, signal_handle_func);
|
| 1403 | +
|
| 1404 | + signal(SIGINT, signal_handle_func);
|
| 1405 | + signal(SIGQUIT, signal_handle_func);
|
| 1406 | + signal(SIGTERM, signal_handle_func);
|
| 1407 | + signal(SIGPIPE, signal_handle_func);
|
| 1408 |
|
| 1409 | memset(&vbuf_rec,0,sizeof(vbuf_rec));
|
| 1410 | #if 0
|
| 1411 | @@ -743,27 +763,28 @@ |
| 1412 | else
|
| 1413 | {
|
| 1414 | #endif
|
| 1415 | - while(1){
|
| 1416 | - printf("Please input an voice_demo command:\n");
|
| 1417 | + printf("Please input an voice_demo command:\n");
|
| 1418 | + while(1){
|
| 1419 | if(NULL != fgets(cmdstr, VOICE_CMD_MAX_LEN - 1, stdin)){
|
| 1420 | if(0 == strcmp(EXIT_CMD_STOP, cmdstr) ||
|
| 1421 | 0 == strcmp(EXIT_CMD_Q, cmdstr) ||
|
| 1422 | 0 == strcmp(EXIT_CMD_EXIT, cmdstr)){
|
| 1423 | - vb_buffer_stop_all();
|
| 1424 | - break;
|
| 1425 | - }
|
| 1426 | + vb_buffer_stop_all();
|
| 1427 | + break;
|
| 1428 | + }
|
| 1429 |
|
| 1430 | - printf("len:%d, cmdstr:%s\n", strlen(cmdstr), cmdstr);
|
| 1431 | + RLOGI("len:%d, cmdstr:%s\n", strlen(cmdstr), cmdstr);
|
| 1432 |
|
| 1433 | if(1 >= strlen(cmdstr)){
|
| 1434 | - continue;
|
| 1435 | - }
|
| 1436 | - voice_buffer_cmd_proc(cmdstr);
|
| 1437 | + continue;
|
| 1438 | + }
|
| 1439 | + voice_buffer_cmd_proc(cmdstr);
|
| 1440 | }
|
| 1441 | - }
|
| 1442 | -// }
|
| 1443 | + sleep(5);
|
| 1444 | + }
|
| 1445 | +
|
| 1446 |
|
| 1447 | - printf("voice_demo end\n");
|
| 1448 | + RLOGD("voice_demo end\n");
|
| 1449 |
|
| 1450 | return 0;
|
| 1451 | }
|
| 1452 | diff --git a/esdk/layers/meta-zxic-custom/recipes-lynq/lynq-vb-demo/files/makefile b/esdk/layers/meta-zxic-custom/recipes-lynq/lynq-vb-demo/files/makefile |
| 1453 | index 6a6f960..7117ebc 100755 |
| 1454 | --- a/esdk/layers/meta-zxic-custom/recipes-lynq/lynq-vb-demo/files/makefile |
| 1455 | +++ b/esdk/layers/meta-zxic-custom/recipes-lynq/lynq-vb-demo/files/makefile |
| 1456 | @@ -26,6 +26,7 @@ |
| 1457 | LOCAL_LIBS := \ |
| 1458 | -L. \ |
| 1459 | -ldl \ |
| 1460 | + -llog \ |
| 1461 | -lpthread \ |
| 1462 | -lvoice \ |
| 1463 | |
| 1464 | diff --git a/esdk/layers/meta-zxic-custom/recipes-lynq/lynq-vb-demo/lynq-vb-demo.bb b/esdk/layers/meta-zxic-custom/recipes-lynq/lynq-vb-demo/lynq-vb-demo.bb |
| 1465 | index b01d3b0..5691603 100755 |
| 1466 | --- a/esdk/layers/meta-zxic-custom/recipes-lynq/lynq-vb-demo/lynq-vb-demo.bb |
| 1467 | +++ b/esdk/layers/meta-zxic-custom/recipes-lynq/lynq-vb-demo/lynq-vb-demo.bb |
| 1468 | @@ -3,7 +3,7 @@ |
| 1469 | DESCRIPTION = "lynq-vb-demo" |
| 1470 | LICENSE = "CLOSED" |
| 1471 | LIC_FILES_CHKSUM = "file://LICENSE;md5=b1e07e8d88e26263e71d3a9e2aa9a2ff" |
| 1472 | -DEPENDS += "libvoice" |
| 1473 | +DEPENDS += "libbinder libvoice" |
| 1474 | SRC_URI = "file://lynq_vb_demo.c \ |
| 1475 | file://makefile \ |
| 1476 | " |
| 1477 | diff --git a/esdk/layers/meta-zxic/recipes-app/libvoice/libvoice.bb b/esdk/layers/meta-zxic/recipes-app/libvoice/libvoice.bb |
| 1478 | index b413ee2..236850c 100755 |
| 1479 | --- a/esdk/layers/meta-zxic/recipes-app/libvoice/libvoice.bb |
| 1480 | +++ b/esdk/layers/meta-zxic/recipes-app/libvoice/libvoice.bb |
| 1481 | @@ -1,5 +1,5 @@ |
| 1482 | DESCRIPTION = "libvoice"
|
| 1483 | -DEPENDS = "libtinyalsa libnvram libsoftap libsofttimer"
|
| 1484 | +DEPENDS = "libtinyalsa libnvram libsoftap libsofttimer libdebug-info"
|
| 1485 | SECTION = "lib" |
| 1486 | LICENSE = "zte" |
| 1487 | PV = "1.0.0" |
| 1488 | @@ -15,11 +15,13 @@ |
| 1489 | S = "${WORKDIR}" |
| 1490 | #å¼ç¨å
¬ç¨å¤´æä»¶åç¼è¯é项ã |
| 1491 | include ${BSPDIR}/sources/meta-zxic/conf/app_com.inc
|
| 1492 | +include ${BSPDIR}/sources/meta-zxic/conf/pub.inc
|
| 1493 | CFLAGS_append = "-I ${BSPDIR}/zxic_code/zxic_source/zxic_app_open/platform/libtinyalsa/include"
|
| 1494 | CFLAGS_append = "-I ${BSPDIR}/zxic_code/zxic_source/linux-5.10/include/linux"
|
| 1495 |
|
| 1496 | |
| 1497 | CFLAGS_append += "${@bb.utils.contains("CONFIG_VB_TRANSMIT_INTF", "RTP", "-I ${BSPDIR}/zxic_code/zxic_source/zxic_app/librtp/include", "", d)}"
|
| 1498 | +CFLAGS_append += "${ZXIC_EXTRA_CFLAGS}"
|
| 1499 | DEPENDS += "${@bb.utils.contains('CONFIG_VB_TRANSMIT_INTF', 'RTP', 'librtp', '', d)}"
|
| 1500 | #ç¼è¯ |
| 1501 | do_compile () { |
| 1502 | diff --git a/esdk/layers/meta-zxic/recipes-app/nvserver/nvserver.bb b/esdk/layers/meta-zxic/recipes-app/nvserver/nvserver.bb |
| 1503 | index 69ad466..e7cf838 100755 |
| 1504 | --- a/esdk/layers/meta-zxic/recipes-app/nvserver/nvserver.bb |
| 1505 | +++ b/esdk/layers/meta-zxic/recipes-app/nvserver/nvserver.bb |
| 1506 | @@ -1,6 +1,6 @@ |
| 1507 | DESCRIPTION = "nvserver" |
| 1508 | #nvserverä¾èµlibnvramåº |
| 1509 | -DEPENDS = "libmtd libnvram libflags libsd-daemon" |
| 1510 | +DEPENDS = "libmtd libnvram libflags libsd-daemon libdebug-info" |
| 1511 | SECTION = "app" |
| 1512 | LICENSE = "zte" |
| 1513 | PV = "1.0.0" |
| 1514 | diff --git a/esdk/layers/meta-zxic/recipes-app/sntp/sntp.bb b/esdk/layers/meta-zxic/recipes-app/sntp/sntp.bb |
| 1515 | index dd579d3..37b2b5f 100755 |
| 1516 | --- a/esdk/layers/meta-zxic/recipes-app/sntp/sntp.bb |
| 1517 | +++ b/esdk/layers/meta-zxic/recipes-app/sntp/sntp.bb |
| 1518 | @@ -50,7 +50,9 @@ |
| 1519 | if ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','true','false',d)}; then |
| 1520 | install -Dm 0755 ${WORKDIR}/sntp.sysvinit ${D}${sysconfdir}/init.d/sntp |
| 1521 | install -d ${D}${sysconfdir}/rcS.d |
| 1522 | - ln -s ../init.d/sntp ${D}${sysconfdir}/rcS.d/S22sntp |
| 1523 | + #xy.he@20250211 bug-view-378 add for disable sntp autostart start |
| 1524 | + #ln -s ../init.d/sntp ${D}${sysconfdir}/rcS.d/S22sntp |
| 1525 | + #xy.he@20250211 bug-view-378 add for disable sntp autostart end |
| 1526 | fi |
| 1527 | |
| 1528 | #install elfs |
| 1529 | @@ -73,4 +75,4 @@ |
| 1530 | SYSTEMD_SERVICE_${PN} = "sntp.service" |
| 1531 | SYSTEMD_AUTO_ENABLE_${PN} = "enable" |
| 1532 | |
| 1533 | -RDEPENDS_${PN} = " libdebug-info libnvram libsoftap libsofttimer" |
| 1534 | \ No newline at end of file |
| 1535 | +RDEPENDS_${PN} = " libdebug-info libnvram libsoftap libsofttimer" |
| 1536 | diff --git a/esdk/layers/meta-zxic/recipes-app/zxic-debug/zxic-debug.bb b/esdk/layers/meta-zxic/recipes-app/zxic-debug/zxic-debug.bb |
| 1537 | index 61650fa..0386349 100755 |
| 1538 | --- a/esdk/layers/meta-zxic/recipes-app/zxic-debug/zxic-debug.bb |
| 1539 | +++ b/esdk/layers/meta-zxic/recipes-app/zxic-debug/zxic-debug.bb |
| 1540 | @@ -1,6 +1,6 @@ |
| 1541 | DESCRIPTION = "zxic-debug" |
| 1542 | #zxic-debugä¾èµlibnvramåº |
| 1543 | -DEPENDS = "libnvram" |
| 1544 | +DEPENDS = "libnvram openssl " |
| 1545 | SECTION = "app" |
| 1546 | LICENSE = "zte" |
| 1547 | PV = "1.0.0" |
| 1548 | diff --git a/esdk/layers/meta-zxic/recipes-core/busybox/busybox/busybox-1.33.1/0104-zxic-reboot-print-ppid.patch b/esdk/layers/meta-zxic/recipes-core/busybox/busybox/busybox-1.33.1/0104-zxic-reboot-print-ppid.patch |
| 1549 | new file mode 100755 |
| 1550 | index 0000000..fe957aa |
| 1551 | --- /dev/null |
| 1552 | +++ b/esdk/layers/meta-zxic/recipes-core/busybox/busybox/busybox-1.33.1/0104-zxic-reboot-print-ppid.patch |
| 1553 | @@ -0,0 +1,105 @@ |
| 1554 | +From 788511a2255d0416dfba782853bd20cb55b5ea67 Mon Sep 17 00:00:00 2001 |
| 1555 | +From: =?utf-8?q?=E5=91=A8=E5=9B=BD=E5=9D=A10318000136?= |
| 1556 | + <zhou.guopo@sanechips.com.cn> |
| 1557 | +Date: Thu, 7 Nov 2024 14:18:56 +0800 |
| 1558 | +Subject: [PATCH] zxic reboot print ppid |
| 1559 | + |
| 1560 | +--- |
| 1561 | + init/halt.c | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 1562 | + 1 file changed, 74 insertions(+) |
| 1563 | + |
| 1564 | +diff --git a/init/halt.c b/init/halt.c |
| 1565 | +index ddb03e2..93980b6 100644 |
| 1566 | +--- a/init/halt.c |
| 1567 | ++++ b/init/halt.c |
| 1568 | +@@ -154,6 +154,78 @@ static int init_was_not_there(void) |
| 1569 | + # define init_was_not_there() 0 |
| 1570 | + #endif |
| 1571 | + |
| 1572 | ++extern int sc_debug_info_record(char *id, const char *format, ...); |
| 1573 | ++static void get_app_name_by_pid(int pid, char *app_name, int app_name_len) |
| 1574 | ++{ |
| 1575 | ++ char file_comm[256]; |
| 1576 | ++ FILE *pfile; |
| 1577 | ++ size_t len; |
| 1578 | ++ |
| 1579 | ++ memset(file_comm, 0, sizeof(file_comm)); |
| 1580 | ++ snprintf(file_comm, sizeof(file_comm), "/proc/%d/comm", pid); |
| 1581 | ++ |
| 1582 | ++ pfile = fopen(file_comm, "r"); |
| 1583 | ++ if (pfile) |
| 1584 | ++ { |
| 1585 | ++ memset(app_name, 0, app_name_len); |
| 1586 | ++ fgets(app_name, app_name_len, pfile); |
| 1587 | ++ app_name[app_name_len-1] = '\0'; |
| 1588 | ++ app_name[strlen(app_name) - 1] = '\0'; //last byte is \n |
| 1589 | ++ fclose(pfile); |
| 1590 | ++ } |
| 1591 | ++} |
| 1592 | ++ |
| 1593 | ++static int get_ppid(int pid) { |
| 1594 | ++ char path[256]; |
| 1595 | ++ snprintf(path, sizeof(path), "/proc/%d/stat", pid); |
| 1596 | ++ |
| 1597 | ++ FILE *fp = fopen(path, "r"); |
| 1598 | ++ if (fp == NULL) { |
| 1599 | ++ perror("fopen"); |
| 1600 | ++ return -1; |
| 1601 | ++ } |
| 1602 | ++ |
| 1603 | ++ int ppid = -1; |
| 1604 | ++ // éè¿è§£æç¬¬4åï¼ppidï¼æ¥è·åç¶è¿ç¨ID |
| 1605 | ++ fscanf(fp, "%*d %*s %*c %d", &ppid); |
| 1606 | ++ fclose(fp); |
| 1607 | ++ return ppid; |
| 1608 | ++} |
| 1609 | ++ |
| 1610 | ++static int get_reboot_caller(char *applet_name) |
| 1611 | ++{ |
| 1612 | ++ int pid = get_ppid(getpid()); |
| 1613 | ++ char app_name[32]; |
| 1614 | ++ int app_name_len = sizeof(app_name); |
| 1615 | ++ int try_cnt = 0; |
| 1616 | ++ |
| 1617 | ++ while(1) |
| 1618 | ++ { |
| 1619 | ++ if (try_cnt > 5) { |
| 1620 | ++ strcpy(app_name, "unkown"); |
| 1621 | ++ break; |
| 1622 | ++ } |
| 1623 | ++ try_cnt++; |
| 1624 | ++ if (pid == 1) { |
| 1625 | ++ get_app_name_by_pid(pid, app_name, app_name_len); |
| 1626 | ++ break; //init |
| 1627 | ++ } |
| 1628 | ++ get_app_name_by_pid(pid, app_name, app_name_len); |
| 1629 | ++ if ((strcmp(app_name, "sh") == 0) || (strcmp(app_name, "bash") == 0)) { |
| 1630 | ++ //printf("shell %s continue %d\n", app_name, strlen(app_name)); |
| 1631 | ++ pid = get_ppid(pid); //sh continue |
| 1632 | ++ } else { |
| 1633 | ++ //printf("not sh break %s %d\n", app_name, strlen(app_name)); |
| 1634 | ++ break; //not sh |
| 1635 | ++ } |
| 1636 | ++ } |
| 1637 | ++ |
| 1638 | ++ sc_debug_info_record("cap_reboot", "call %s reset_by %s(%d)\n", applet_name, app_name, pid); |
| 1639 | ++ printf("call %s by %s(%d)\n", applet_name, app_name, pid); |
| 1640 | ++ |
| 1641 | ++ return 0; |
| 1642 | ++} |
| 1643 | ++ |
| 1644 | + int halt_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
| 1645 | + int halt_main(int argc UNUSED_PARAM, char **argv) |
| 1646 | + { |
| 1647 | +@@ -180,6 +252,8 @@ int halt_main(int argc UNUSED_PARAM, char **argv) |
| 1648 | + for (which = 0; "hpr"[which] != applet_name[0]; which++) |
| 1649 | + continue; |
| 1650 | + |
| 1651 | ++ get_reboot_caller(applet_name); //add by zxic, print parent proccess name and pid |
| 1652 | ++ |
| 1653 | + /* Parse and handle arguments */ |
| 1654 | + /* We support -w even if !ENABLE_FEATURE_WTMP, |
| 1655 | + * in order to not break scripts. |
| 1656 | +-- |
| 1657 | +2.17.1 |
| 1658 | + |
| 1659 | diff --git a/esdk/layers/meta-zxic/recipes-core/busybox/busybox_1.33.1.bb b/esdk/layers/meta-zxic/recipes-core/busybox/busybox_1.33.1.bb |
| 1660 | index a5a5bf4..43a4540 100755 |
| 1661 | --- a/esdk/layers/meta-zxic/recipes-core/busybox/busybox_1.33.1.bb |
| 1662 | +++ b/esdk/layers/meta-zxic/recipes-core/busybox/busybox_1.33.1.bb |
| 1663 | @@ -52,8 +52,9 @@ |
| 1664 | file://busybox-1.33.1/0100-zxic-tty-disable-soft-flow-control.patch \ |
| 1665 | file://busybox-1.33.1/700-dhcpd-fix.patch \ |
| 1666 | " |
| 1667 | - |
| 1668 | -SRC_URI += "file://busybox-1.33.1/010-syslogd-recive-remote-log.patch" |
| 1669 | +#LYNQ_MODIFY_ZXW_TASK935_XF.Li_20250122_START |
| 1670 | +#SRC_URI += "file://busybox-1.33.1/010-syslogd-recive-remote-log.patch" |
| 1671 | +#LYNQ_MODIFY_ZXW_TASK935_XF.Li_20250122_END |
| 1672 | SRC_URI += "file://busybox-1.33.1/020-syslogd-filesize-and-filenum-parameter-nvcfg.patch" |
| 1673 | #SRC_URI += "file://busybox-1.33.1/022-syslogd-replace-remote-log-facility.patch" |
| 1674 | SRC_URI += "file://busybox-1.33.1/0100-zxic-add-sync-after-chmod.patch" |
| 1675 | @@ -61,6 +62,7 @@ |
| 1676 | SRC_URI += "file://busybox-1.33.1/0102-zxic-ash-read-etc-profile.patch" |
| 1677 | SRC_URI += "file://busybox-1.33.1/0103-top-short-lived-processes-optimize.patch" |
| 1678 | SRC_URI += "file://busybox-1.33.1/0103-syslogd-data-encryption.patch" |
| 1679 | +SRC_URI += "file://busybox-1.33.1/0104-zxic-reboot-print-ppid.patch" |
| 1680 | |
| 1681 | SRC_URI_append_libc-musl = " file://busybox-1.33.1/musl.cfg " |
| 1682 | |
| 1683 | diff --git a/esdk/layers/meta-zxic/recipes-core/busybox/busybox_1.33.1.inc b/esdk/layers/meta-zxic/recipes-core/busybox/busybox_1.33.1.inc |
| 1684 | index 2efbe4d..1b610f9 100755 |
| 1685 | --- a/esdk/layers/meta-zxic/recipes-core/busybox/busybox_1.33.1.inc |
| 1686 | +++ b/esdk/layers/meta-zxic/recipes-core/busybox/busybox_1.33.1.inc |
| 1687 | @@ -3,7 +3,7 @@ |
| 1688 | HOMEPAGE = "https://www.busybox.net" |
| 1689 | BUGTRACKER = "https://bugs.busybox.net/" |
| 1690 | |
| 1691 | -DEPENDS += "kern-tools-native virtual/crypt libnvram" |
| 1692 | +DEPENDS += "kern-tools-native virtual/crypt libnvram libdebug-info" |
| 1693 | |
| 1694 | # bzip2 applet in busybox is based on lightly-modified bzip2-1.0.4 source |
| 1695 | # the GPL is version 2 only |
| 1696 | diff --git a/esdk/layers/meta-zxic/recipes-core/glibc/glibc_%.bbappend b/esdk/layers/meta-zxic/recipes-core/glibc/glibc_%.bbappend |
| 1697 | index 1ea730c..7a45c61 100755 |
| 1698 | --- a/esdk/layers/meta-zxic/recipes-core/glibc/glibc_%.bbappend |
| 1699 | +++ b/esdk/layers/meta-zxic/recipes-core/glibc/glibc_%.bbappend |
| 1700 | @@ -2,8 +2,7 @@ |
| 1701 | FILESEXTRAPATHS_prepend := "${THISDIR}/files:" |
| 1702 | |
| 1703 | SRC_URI += " \ |
| 1704 | - file://0001-write-log-to-zcat-tool.patch \ |
| 1705 | - file://0002-fix-y2038-time_t-unsigned-long.patch \ |
| 1706 | + file://0001-write-log-to-zcat-tool.patch \ |
| 1707 | " |
| 1708 | |
| 1709 | do_install_append() { |
| 1710 | diff --git a/upstream/linux-5.10/drivers/mfd/zx234290-core.c b/upstream/linux-5.10/drivers/mfd/zx234290-core.c |
| 1711 | index d43085f..6da76d2 100755 |
| 1712 | --- a/upstream/linux-5.10/drivers/mfd/zx234290-core.c |
| 1713 | +++ b/upstream/linux-5.10/drivers/mfd/zx234290-core.c |
| 1714 | @@ -246,15 +246,16 @@ |
| 1715 | #endif |
| 1716 | #if 1 |
| 1717 | extern int Zx234290_SetUserReg_PSM(unsigned char data); |
| 1718 | +extern void zxic_reset_reason(int reason, const char *cpu, const char *app); |
| 1719 | |
| 1720 | void zx29_restart(const char * cmd) |
| 1721 | { |
| 1722 | /*set reset value = 1*/ |
| 1723 | - unsigned char status = ZX234290_USER_RST_TO_NORMAL; |
| 1724 | + unsigned char status = USER_RST_TO_NORMAL; |
| 1725 | |
| 1726 | printk(KERN_INFO"restart:enter reboot :reset to normal\n"); |
| 1727 | + zxic_reset_reason(2, "cap", current->comm); |
| 1728 | |
| 1729 | - status = ZX234290_USER_RST_TO_NORMAL; |
| 1730 | Zx234290_SetUserReg_PSM(status); |
| 1731 | } |
| 1732 | |
| 1733 | diff --git a/upstream/linux-5.10/drivers/mmc/core/mmc_ramdump.c b/upstream/linux-5.10/drivers/mmc/core/mmc_ramdump.c |
| 1734 | index be7309c..9235ec4 100755 |
| 1735 | --- a/upstream/linux-5.10/drivers/mmc/core/mmc_ramdump.c |
| 1736 | +++ b/upstream/linux-5.10/drivers/mmc/core/mmc_ramdump.c |
| 1737 | @@ -530,7 +530,7 @@ |
| 1738 | } |
| 1739 | |
| 1740 | //ÉèÖöÁÊý¾Ý´óС |
| 1741 | -int mmc_bread(u32 start_addr, u32 data_size, void *dst) |
| 1742 | +int mmc_bread(u64 start_addr, u32 data_size, void *dst) |
| 1743 | { |
| 1744 | int ret; |
| 1745 | u32 src = 0; |
| 1746 | @@ -548,7 +548,7 @@ |
| 1747 | if(block_addr == 0) |
| 1748 | src = start_addr; |
| 1749 | else |
| 1750 | - src = start_addr/MMC_BLOCK_SIZE; |
| 1751 | + src = (u32)(start_addr/MMC_BLOCK_SIZE); |
| 1752 | |
| 1753 | if(blk_count){ |
| 1754 | ret= zx_mmc_read(src, (u8 *) dst, blk_count * MMC_BLOCK_SIZE); |
| 1755 | @@ -573,7 +573,7 @@ |
| 1756 | return data_size; |
| 1757 | } |
| 1758 | |
| 1759 | -int mmc_bwrite(u32 start_addr, u32 data_size, void *src_buf) |
| 1760 | +int mmc_bwrite(u64 start_addr, u32 data_size, void *src_buf) |
| 1761 | { |
| 1762 | int ret; |
| 1763 | u32 start_blk = 0; |
| 1764 | @@ -594,7 +594,7 @@ |
| 1765 | if(block_addr == 0) |
| 1766 | start_blk = start_addr; |
| 1767 | else |
| 1768 | - start_blk = (start_addr/MMC_BLOCK_SIZE); |
| 1769 | + start_blk = (u32)(start_addr/MMC_BLOCK_SIZE); |
| 1770 | |
| 1771 | if(blk_count){ |
| 1772 | ret= zx_mmc_write(start_blk, (u8 *)src_buf, blk_count * MMC_BLOCK_SIZE); |
| 1773 | diff --git a/upstream/linux-5.10/drivers/mtd/mtdcore.c b/upstream/linux-5.10/drivers/mtd/mtdcore.c |
| 1774 | index a52a2c8..c07e824 100755 |
| 1775 | --- a/upstream/linux-5.10/drivers/mtd/mtdcore.c |
| 1776 | +++ b/upstream/linux-5.10/drivers/mtd/mtdcore.c |
| 1777 | @@ -228,6 +228,17 @@ |
| 1778 | } |
| 1779 | static DEVICE_ATTR(ecc_strength, S_IRUGO, mtd_ecc_strength_show, NULL); |
| 1780 | |
| 1781 | +#define MTD_RECORD_NAME_MAX (16) |
| 1782 | +struct zxic_mtd_record |
| 1783 | +{ |
| 1784 | + char name[MTD_RECORD_NAME_MAX]; |
| 1785 | + unsigned int erase_times; |
| 1786 | + unsigned int write_times; |
| 1787 | +}; |
| 1788 | + |
| 1789 | +static struct zxic_mtd_record g_zxic_mtd_record; //save data |
| 1790 | +static int record_mtd_trigger_flag; // 0 stop record, 1 start record |
| 1791 | + |
| 1792 | static ssize_t mtd_bitflip_threshold_show(struct device *dev, |
| 1793 | struct device_attribute *attr, |
| 1794 | char *buf) |
| 1795 | @@ -1111,6 +1122,9 @@ |
| 1796 | |
| 1797 | adjinstr.addr += mst_ofs; |
| 1798 | |
| 1799 | + if (record_mtd_trigger_flag && (strcmp(mtd->name, g_zxic_mtd_record.name) == 0)) |
| 1800 | + g_zxic_mtd_record.erase_times++; |
| 1801 | + |
| 1802 | ret = master->_erase(master, &adjinstr); |
| 1803 | |
| 1804 | if (adjinstr.fail_addr != MTD_FAIL_ADDR_UNKNOWN) { |
| 1805 | @@ -1232,6 +1246,9 @@ |
| 1806 | }; |
| 1807 | int ret; |
| 1808 | |
| 1809 | + if (record_mtd_trigger_flag && (strcmp(mtd->name, g_zxic_mtd_record.name) == 0)) |
| 1810 | + g_zxic_mtd_record.write_times++; |
| 1811 | + |
| 1812 | ret = mtd_write_oob(mtd, to, &ops); |
| 1813 | *retlen = ops.retlen; |
| 1814 | |
| 1815 | @@ -2203,6 +2220,107 @@ |
| 1816 | |
| 1817 | static struct proc_dir_entry *proc_mtd; |
| 1818 | |
| 1819 | +/* Started by AICoder, pid:5fc9ey6dc555c241432c0bd800e0358e8d683380 */ |
| 1820 | +static struct proc_dir_entry *proc_record_mtd_name; |
| 1821 | +static struct proc_dir_entry *proc_record_mtd_trigger; |
| 1822 | +static struct proc_dir_entry *proc_record_mtd_erase_times; |
| 1823 | + |
| 1824 | +static ssize_t proc_record_mtd_name_read(struct file *file, char __user *user_buffer, size_t count, loff_t *offset) { |
| 1825 | + if (g_zxic_mtd_record.name[0] != '\0') |
| 1826 | + return simple_read_from_buffer(user_buffer, count, offset, g_zxic_mtd_record.name, strlen(g_zxic_mtd_record.name)); |
| 1827 | + else |
| 1828 | + return 0; |
| 1829 | +} |
| 1830 | + |
| 1831 | +static ssize_t proc_record_mtd_name_write(struct file *file, const char __user *user_buffer, size_t count, loff_t *offset) { |
| 1832 | + if (count <= 1 || count >= MTD_RECORD_NAME_MAX) { |
| 1833 | + return -EINVAL; |
| 1834 | + } |
| 1835 | + |
| 1836 | + if (copy_from_user(g_zxic_mtd_record.name, user_buffer, count)) { |
| 1837 | + return -EFAULT; |
| 1838 | + } |
| 1839 | + |
| 1840 | + g_zxic_mtd_record.name[count-1] = '\0'; // last 1 byte 0x0a |
| 1841 | + g_zxic_mtd_record.erase_times = 0; |
| 1842 | + g_zxic_mtd_record.write_times = 0; |
| 1843 | + |
| 1844 | + return count; |
| 1845 | +} |
| 1846 | + |
| 1847 | +static ssize_t proc_record_mtd_trigger_read(struct file *file, char __user *user_buffer, size_t count, loff_t *offset) { |
| 1848 | + if (record_mtd_trigger_flag) |
| 1849 | + return simple_read_from_buffer(user_buffer, count, offset, "start\n", 6); |
| 1850 | + else |
| 1851 | + return simple_read_from_buffer(user_buffer, count, offset, "stop\n", 5); |
| 1852 | +} |
| 1853 | + |
| 1854 | +static ssize_t proc_record_mtd_trigger_write(struct file *file, const char __user *user_buffer, size_t count, loff_t *offset) { |
| 1855 | + char buffer[10]; |
| 1856 | + |
| 1857 | + if (count < 4 || count > 6) |
| 1858 | + return -EINVAL; |
| 1859 | + if (g_zxic_mtd_record.name[0] == '\0') |
| 1860 | + return -EINVAL; // mtd name not set |
| 1861 | + if (copy_from_user(buffer, user_buffer, count)) |
| 1862 | + return -EFAULT; |
| 1863 | + |
| 1864 | + buffer[count-1] = '\0'; // last 1 byte 0x0a |
| 1865 | + //printk("record mtd trigger:%s\n", buffer); |
| 1866 | + |
| 1867 | + if (memcmp(buffer, "start", 5) == 0) { |
| 1868 | + printk(KERN_WARNING "record mtd erase and write start\n"); |
| 1869 | + g_zxic_mtd_record.erase_times = 0; |
| 1870 | + g_zxic_mtd_record.write_times = 0; |
| 1871 | + record_mtd_trigger_flag = 1; |
| 1872 | + } else { |
| 1873 | + if (memcmp(buffer, "stop", 4) == 0) |
| 1874 | + { |
| 1875 | + printk(KERN_WARNING "record mtd erase and write stop\n"); |
| 1876 | + record_mtd_trigger_flag = 0; |
| 1877 | + } |
| 1878 | + else |
| 1879 | + { |
| 1880 | + return -EINVAL; |
| 1881 | + } |
| 1882 | + } |
| 1883 | + |
| 1884 | + return count; |
| 1885 | +} |
| 1886 | + |
| 1887 | +static int proc_record_mtd_erase_times_show(struct seq_file *m, void *v) |
| 1888 | +{ |
| 1889 | + seq_printf(m, "mtd:%s\n", g_zxic_mtd_record.name); |
| 1890 | + seq_printf(m, "erase_times:%u\n", g_zxic_mtd_record.erase_times); |
| 1891 | + seq_printf(m, "write_times:%u\n", g_zxic_mtd_record.write_times); |
| 1892 | + return 0; |
| 1893 | +} |
| 1894 | + |
| 1895 | +static const struct proc_ops proc_record_mtd_name_fops = { |
| 1896 | + .proc_read = proc_record_mtd_name_read, |
| 1897 | + .proc_write = proc_record_mtd_name_write, |
| 1898 | +}; |
| 1899 | + |
| 1900 | +static const struct proc_ops proc_record_mtd_trigger_fops = { |
| 1901 | + .proc_read = proc_record_mtd_trigger_read, |
| 1902 | + .proc_write = proc_record_mtd_trigger_write, |
| 1903 | +}; |
| 1904 | + |
| 1905 | +static int zxic_record_proc_init(void) |
| 1906 | +{ |
| 1907 | + proc_record_mtd_name = proc_create("record_mtd_name", 0666, NULL, &proc_record_mtd_name_fops); |
| 1908 | + if (!proc_record_mtd_name) |
| 1909 | + return -ENOMEM; |
| 1910 | + proc_record_mtd_trigger = proc_create("record_mtd_trigger", 0666, NULL, &proc_record_mtd_trigger_fops); |
| 1911 | + if (!proc_record_mtd_trigger) |
| 1912 | + return -ENOMEM; |
| 1913 | + proc_record_mtd_erase_times = proc_create_single("record_mtd_erase_times", 0, NULL, proc_record_mtd_erase_times_show); |
| 1914 | + if (!proc_record_mtd_erase_times) |
| 1915 | + return -ENOMEM; |
| 1916 | + return 0; |
| 1917 | +} |
| 1918 | +/* Ended by AICoder, pid:5fc9ey6dc555c241432c0bd800e0358e8d683380 */ |
| 1919 | + |
| 1920 | static int __init init_mtd(void) |
| 1921 | { |
| 1922 | int ret; |
| 1923 | @@ -2219,6 +2337,9 @@ |
| 1924 | |
| 1925 | proc_mtd = proc_create_single("mtd", 0, NULL, mtd_proc_show); |
| 1926 | |
| 1927 | + if (zxic_record_proc_init() < 0) |
| 1928 | + printk(KERN_ERR "zxic_record_proc_init error\n"); |
| 1929 | + |
| 1930 | ret = init_mtdchar(); |
| 1931 | if (ret) |
| 1932 | goto out_procfs; |
| 1933 | diff --git a/upstream/linux-5.10/drivers/net/ethernet/zte/zx29_gmac.c b/upstream/linux-5.10/drivers/net/ethernet/zte/zx29_gmac.c |
| 1934 | index 668d9d9..32cb5a5 100755 |
| 1935 | --- a/upstream/linux-5.10/drivers/net/ethernet/zte/zx29_gmac.c |
| 1936 | +++ b/upstream/linux-5.10/drivers/net/ethernet/zte/zx29_gmac.c |
| 1937 | @@ -25,8 +25,11 @@ |
| 1938 | #include <linux/gpio.h>
|
| 1939 | #include <linux/of_gpio.h>
|
| 1940 | #include <linux/device.h>
|
| 1941 | +#include <uapi/linux/sched/types.h>
|
| 1942 | #include "zx29_gmac.h"
|
| 1943 |
|
| 1944 | +#define GMAC_RX_WORKER_TH 1
|
| 1945 | +
|
| 1946 | #define gmac_printk(_format, _args...) do{printk(KERN_INFO"gmac," _format "\n",##_args);}while(0)
|
| 1947 |
|
| 1948 | static u8 zx29_gmac_addr[MAC_ADDR_LENTH] = {0xec,0x1d,0x7f,0xb0,0x2f,0x32};
|
| 1949 | @@ -86,10 +89,11 @@ |
| 1950 |
|
| 1951 | d = (struct bd_tx *)priv->dma_tx_vir;
|
| 1952 |
|
| 1953 | +
|
| 1954 | if (n == priv->tx_bd_offset)
|
| 1955 | return 0;
|
| 1956 |
|
| 1957 | - if (d[n].TDES0 & DMA_OWNER)
|
| 1958 | + if ( (!d) || (d[n].TDES0 & DMA_OWNER))
|
| 1959 | return 0;
|
| 1960 |
|
| 1961 | if (d[n].skb == NULL)
|
| 1962 | @@ -123,7 +127,7 @@ |
| 1963 | int n = prv->rx_bd_offset;
|
| 1964 | struct bd_rx *d = (struct bd_rx*)prv->dma_rx_vir;
|
| 1965 |
|
| 1966 | - if(d[n].RDES0 & DMA_OWNER)
|
| 1967 | + if ((!d) || (d[n].RDES0 & DMA_OWNER))
|
| 1968 | {
|
| 1969 | return 0;
|
| 1970 | }
|
| 1971 | @@ -359,6 +363,56 @@ |
| 1972 | return (exhausted > 10);
|
| 1973 | }
|
| 1974 |
|
| 1975 | +#ifdef GMAC_RX_WORKER_TH
|
| 1976 | +static struct task_struct *s_gmac_rx_worker = 0;
|
| 1977 | +static int ko_remove_flag = 0;
|
| 1978 | +struct semaphore s_gmac_rx_sem = {0};
|
| 1979 | +static int gmac_rx_worker(void *dev)
|
| 1980 | +{
|
| 1981 | + struct net_device *ndev = (struct net_device *)dev;
|
| 1982 | + struct zx29_gmac_dev *prv = (struct zx29_gmac_dev *)netdev_priv(ndev);
|
| 1983 | + volatile unsigned *gmac = (unsigned *)ndev->base_addr;
|
| 1984 | + unsigned int events = prv->int_event;
|
| 1985 | +
|
| 1986 | + do {
|
| 1987 | + down(&s_gmac_rx_sem);
|
| 1988 | + if (ko_remove_flag)
|
| 1989 | + return 0;
|
| 1990 | + events = prv->int_event;
|
| 1991 | + do {
|
| 1992 | + if (events & INT_ST_TX)
|
| 1993 | + zx29_gmac_tx(ndev);
|
| 1994 | +
|
| 1995 | + if (events & INT_ST_RX)
|
| 1996 | + zx29_gmac_rx(ndev);
|
| 1997 | +
|
| 1998 | + events = MAC(0x1014);
|
| 1999 | + MAC(0x1014) = events;
|
| 2000 | + } while (events & (INT_ST_TX | INT_ST_RX));
|
| 2001 | +
|
| 2002 | + #ifndef GMAC_NO_INT
|
| 2003 | + mac_int_enable();
|
| 2004 | + #endif
|
| 2005 | + } while(1);
|
| 2006 | +
|
| 2007 | + return 0;
|
| 2008 | +}
|
| 2009 | +
|
| 2010 | +static int zx29_gmac_worker(struct net_device* pnetdev)
|
| 2011 | +{
|
| 2012 | + struct sched_param param = {.sched_priority = 40};
|
| 2013 | +
|
| 2014 | + sema_init(&s_gmac_rx_sem, 0);
|
| 2015 | +
|
| 2016 | + s_gmac_rx_worker = kthread_create(gmac_rx_worker, (void *)pnetdev, "gmac_rx_worker");
|
| 2017 | +
|
| 2018 | + //sched_setscheduler(s_gmac_rx_worker, SCHED_RR, ¶m);
|
| 2019 | + wake_up_process(s_gmac_rx_worker);
|
| 2020 | +
|
| 2021 | + return 0;
|
| 2022 | +}
|
| 2023 | +
|
| 2024 | +#endif
|
| 2025 |
|
| 2026 | #ifndef GMAC_NO_INT
|
| 2027 | static irqreturn_t zx29_gmac_interrupt(int irq, void *dev_id)
|
| 2028 | @@ -371,8 +425,11 @@ |
| 2029 | MAC(0x1014) = priv->int_event;
|
| 2030 |
|
| 2031 | mac_int_disable();
|
| 2032 | +#ifndef GMAC_RX_WORKER_TH
|
| 2033 | tasklet_schedule(&priv->tasklet);
|
| 2034 | -
|
| 2035 | +#else
|
| 2036 | + up(&s_gmac_rx_sem);
|
| 2037 | +#endif
|
| 2038 | return IRQ_HANDLED;
|
| 2039 | }
|
| 2040 |
|
| 2041 | @@ -424,7 +481,11 @@ |
| 2042 | ktime_t gmac_schdule_time = ktime_set(0, delay_in_us * 1000);
|
| 2043 |
|
| 2044 | hrtimer_forward_now(timer, gmac_schdule_time);
|
| 2045 | +#ifndef GMAC_RX_WORKER_TH
|
| 2046 | tasklet_schedule(g_gmac_tasklet);
|
| 2047 | +#else
|
| 2048 | + up(&s_gmac_rx_sem);
|
| 2049 | +#endif
|
| 2050 | return HRTIMER_RESTART;
|
| 2051 | }
|
| 2052 | #endif
|
| 2053 | @@ -759,7 +820,7 @@ |
| 2054 | return ret;
|
| 2055 | }
|
| 2056 |
|
| 2057 | - netif_carrier_on(ndev);
|
| 2058 | +// netif_carrier_on(ndev);
|
| 2059 | spin_unlock_irqrestore(&priv->lock, flags);
|
| 2060 |
|
| 2061 | phy_start(priv->phydev);
|
| 2062 | @@ -1725,12 +1786,46 @@ |
| 2063 |
|
| 2064 | /*zw.wang add for switching the primary/secondary mode of gmac on 20240118 end */
|
| 2065 |
|
| 2066 | +/*zw.wang add a new interface to obtain the PHY link status on 20250226 begin*/
|
| 2067 | +ssize_t phy_pma_link_show(struct device *dev, struct device_attribute *attr,
|
| 2068 | + char *buf)
|
| 2069 | +{
|
| 2070 | + int val = 0;
|
| 2071 | + struct platform_device *pdev = to_platform_device(dev);
|
| 2072 | + if (!pdev) {
|
| 2073 | + printk(KERN_ERR "%s : %s pdev : %x \n", __func__, __LINE__,
|
| 2074 | + pdev);
|
| 2075 | + return -1;
|
| 2076 | + }
|
| 2077 | + struct net_device *ndev = platform_get_drvdata(pdev);
|
| 2078 | + if (!ndev) {
|
| 2079 | + printk(KERN_ERR "%s : %s ndev : %x \n", __func__, __LINE__,
|
| 2080 | + ndev);
|
| 2081 | + return -1;
|
| 2082 | + }
|
| 2083 | + struct zx29_gmac_dev *priv = (struct zx29_gmac_dev *)netdev_priv(ndev);
|
| 2084 | + if (!priv) {
|
| 2085 | + printk(KERN_ERR "%s : %s priv : %x \n", __func__, __LINE__,
|
| 2086 | + priv);
|
| 2087 | + return -1;
|
| 2088 | + }
|
| 2089 | + mdiobus_write(priv->phydev->mdio.bus, priv->phydev->mdio.addr, 0x0d,0x1);
|
| 2090 | + mdiobus_write(priv->phydev->mdio.bus, priv->phydev->mdio.addr, 0x0e,0x1);
|
| 2091 | + mdiobus_write(priv->phydev->mdio.bus, priv->phydev->mdio.addr, 0x0d,0x4000 | 0x1);
|
| 2092 | + val = mdiobus_read(priv->phydev->mdio.bus, priv->phydev->mdio.addr,0x0e);
|
| 2093 | + sprintf(buf, "link : %s\n", (val & BIT(2)) ? "yes":"no");
|
| 2094 | + return strlen(buf);
|
| 2095 | +}
|
| 2096 | +
|
| 2097 | +/*zw.wang add a new interface to obtain the PHY link status on 20250226 end*/
|
| 2098 | +
|
| 2099 | static DEVICE_ATTR(gmac_test, 0664, show_fun, store_fun);
|
| 2100 | static DEVICE_ATTR(mdio_test, 0664, mdio_show, mdio_store);
|
| 2101 | static DEVICE_ATTR(free_mdio, 0664, free_mdio_show, free_mdio_store);
|
| 2102 | static DEVICE_ATTR(debug_on, 0664, debug_on_show, debug_on_store);
|
| 2103 | static DEVICE_ATTR(gmac_power, 0664, gmac_power_show, gmac_power_store);//jb.qi add for gamc power down on 20231116
|
| 2104 | static DEVICE_ATTR(gmac_master_or_slave, 0664, gmac_master_or_slave_show, gmac_master_or_slave_store);//zw.wang add for switching the primary/secondary mode of gmac on 20240118
|
| 2105 | +static DEVICE_ATTR_RO(phy_pma_link); //zw.wang add a new interface to obtain the PHY link status on 20250226
|
| 2106 |
|
| 2107 | static int zx29_gmac_probe(struct platform_device *pdev)
|
| 2108 | {
|
| 2109 | @@ -1759,6 +1854,7 @@ |
| 2110 | device_create_file(&pdev->dev, &dev_attr_debug_on);
|
| 2111 | device_create_file(&pdev->dev, &dev_attr_gmac_power);//jb.qi add for gamc power down on 20231116
|
| 2112 | device_create_file(&pdev->dev, &dev_attr_gmac_master_or_slave);//zw.wang add for switching the primary/secondary mode of gmac on 20240118
|
| 2113 | + device_create_file(&pdev->dev, &dev_attr_phy_pma_link); //zw.wang add a new interface to obtain the PHY link status on 20250226
|
| 2114 |
|
| 2115 | prv = netdev_priv(ndev);
|
| 2116 | memset(prv, 0, sizeof(*prv));
|
| 2117 | @@ -1851,6 +1947,10 @@ |
| 2118 | goto errdev;
|
| 2119 | }
|
| 2120 |
|
| 2121 | +#ifdef GMAC_RX_WORKER_TH
|
| 2122 | + zx29_gmac_worker(ndev);//gmac_rx_worker
|
| 2123 | +#endif
|
| 2124 | +
|
| 2125 | of_property_read_u32(np, "port-nums", &prv->nports);
|
| 2126 | of_property_read_u32(np, "rmii-ports", &prv->rmii_port);
|
| 2127 | prv->base_addr = ndev->base_addr;
|
| 2128 | @@ -1987,9 +2087,10 @@ |
| 2129 |
|
| 2130 | // gpio_direction_output(priv->gpio_power[0], 1);
|
| 2131 | // msleep(500);
|
| 2132 | - unregister_netdev(ndev);
|
| 2133 | +// unregister_netdev(ndev);
|
| 2134 |
|
| 2135 | phy_disconnect(priv->phydev);
|
| 2136 | + unregister_netdev(ndev);
|
| 2137 |
|
| 2138 | kobj_gmac_del(NULL);
|
| 2139 |
|
| 2140 | @@ -1998,11 +2099,17 @@ |
| 2141 | #ifndef GMAC_NO_INT
|
| 2142 | free_irq(ndev->irq, ndev);
|
| 2143 | #endif
|
| 2144 | +
|
| 2145 | +#ifdef GMAC_RX_WORKER_TH
|
| 2146 | + ko_remove_flag = 1;
|
| 2147 | + up(&s_gmac_rx_sem);
|
| 2148 | +#endif
|
| 2149 | +
|
| 2150 | tasklet_disable(&priv->tasklet);
|
| 2151 | tasklet_kill(&priv->tasklet);
|
| 2152 |
|
| 2153 | - if (priv->dma_rx_vir)
|
| 2154 | - dma_free_coherent(ndev->dev.parent, GMAC_BUF_LEN, priv->dma_rx_vir, priv->dma_rx_phy);
|
| 2155 | + if (priv->dma_rx_vir_init)
|
| 2156 | + dma_free_coherent(ndev->dev.parent, GMAC_BUF_LEN, priv->dma_rx_vir_init, priv->dma_rx_phy_init);
|
| 2157 |
|
| 2158 | pm_relax(&pdev->dev);
|
| 2159 | free_netdev(ndev);
|
| 2160 | @@ -2020,6 +2127,7 @@ |
| 2161 | device_remove_file(&pdev->dev, &dev_attr_debug_on);
|
| 2162 | device_remove_file(&pdev->dev, &dev_attr_gmac_power);//jb.qi add for gamc power down on 20231116
|
| 2163 | device_remove_file(&pdev->dev, &dev_attr_gmac_master_or_slave);//zw.wang add for switching the primary/secondary mode of gmac on 20240118
|
| 2164 | + device_remove_file(&pdev->dev, &dev_attr_phy_pma_link); //zw.wang add a new interface to obtain the PHY link status on 20250226
|
| 2165 | }
|
| 2166 | return 0;
|
| 2167 | }
|
| 2168 | diff --git a/upstream/linux-5.10/drivers/net/ethernet/zte/zx29_gmac_event.c b/upstream/linux-5.10/drivers/net/ethernet/zte/zx29_gmac_event.c |
| 2169 | index 750580b..6df9cfd 100755 |
| 2170 | --- a/upstream/linux-5.10/drivers/net/ethernet/zte/zx29_gmac_event.c |
| 2171 | +++ b/upstream/linux-5.10/drivers/net/ethernet/zte/zx29_gmac_event.c |
| 2172 | @@ -137,7 +137,7 @@ |
| 2173 |
|
| 2174 | void kobj_gmac_del(struct kobject *kobject)
|
| 2175 | {
|
| 2176 | - kset_unregister(kset_gmac);
|
| 2177 | +// kset_unregister(kset_gmac);
|
| 2178 |
|
| 2179 | kobject_uevent(typekobj, KOBJ_REMOVE);
|
| 2180 | kobject_del(typekobj);
|
| 2181 | @@ -150,6 +150,7 @@ |
| 2182 |
|
| 2183 | kfree(gmackobj);
|
| 2184 |
|
| 2185 | + kset_unregister(kset_gmac);
|
| 2186 | printk("[gmac kobj_test: delete!]\n");
|
| 2187 | }
|
| 2188 | EXPORT_SYMBOL(kobj_gmac_del);
|
| 2189 | @@ -278,8 +279,8 @@ |
| 2190 | }
|
| 2191 | kset_gmac = kset_create_and_add("gmac", &gmac_uevent_ops, NULL);
|
| 2192 | kobject_init(gmackobj, &gmacktype);
|
| 2193 | - kobject_add(gmackobj,&kset_gmac->kobj,"%s","gmacconfig");
|
| 2194 | gmackobj->kset = kset_gmac;
|
| 2195 | + kobject_add(gmackobj,&kset_gmac->kobj,"%s","gmacconfig");
|
| 2196 |
|
| 2197 | typekobj = kzalloc(sizeof(*typekobj),GFP_KERNEL);
|
| 2198 | if(!typekobj){
|
| 2199 | @@ -288,8 +289,8 @@ |
| 2200 | }
|
| 2201 | // kset_gmac = kset_create_and_add("gmac", &gmac_uevent_ops, NULL);
|
| 2202 | kobject_init(typekobj, &typektype);
|
| 2203 | - kobject_add(typekobj,&kset_gmac->kobj,"%s",name);
|
| 2204 | typekobj->kset = kset_gmac;
|
| 2205 | + kobject_add(typekobj,&kset_gmac->kobj,"%s",name);
|
| 2206 |
|
| 2207 | strcpy(type, name);
|
| 2208 |
|
| 2209 | diff --git a/upstream/linux-5.10/drivers/net/phy/phy_device.c b/upstream/linux-5.10/drivers/net/phy/phy_device.c |
| 2210 | index d9b53ba..f6a5a56 100755 |
| 2211 | --- a/upstream/linux-5.10/drivers/net/phy/phy_device.c |
| 2212 | +++ b/upstream/linux-5.10/drivers/net/phy/phy_device.c |
| 2213 | @@ -1316,6 +1316,10 @@ |
| 2214 | } |
| 2215 | EXPORT_SYMBOL(phy_sfp_probe); |
| 2216 | |
| 2217 | +static bool phy_drv_supports_irq(struct phy_driver *phydrv) |
| 2218 | +{ |
| 2219 | + return phydrv->config_intr && phydrv->ack_interrupt; |
| 2220 | +} |
| 2221 | /** |
| 2222 | * phy_attach_direct - attach a network device to a given PHY device pointer |
| 2223 | * @dev: network device to attach |
| 2224 | @@ -1421,6 +1425,8 @@ |
| 2225 | |
| 2226 | phydev->state = PHY_READY; |
| 2227 | |
| 2228 | + if (!phy_drv_supports_irq(phydev->drv) && phy_interrupt_is_valid(phydev)) |
| 2229 | + phydev->irq = PHY_POLL; |
| 2230 | /* Port is set to PORT_TP by default and the actual PHY driver will set |
| 2231 | * it to different value depending on the PHY configuration. If we have |
| 2232 | * the generic PHY driver we can't figure it out, thus set the old |
| 2233 | @@ -2819,7 +2825,7 @@ |
| 2234 | if (delay < 0) |
| 2235 | return delay; |
| 2236 | |
| 2237 | - if (delay && size == 0) |
| 2238 | + if (size == 0) |
| 2239 | return delay; |
| 2240 | |
| 2241 | if (delay < delay_values[0] || delay > delay_values[size - 1]) { |
| 2242 | @@ -2852,10 +2858,6 @@ |
| 2243 | } |
| 2244 | EXPORT_SYMBOL(phy_get_internal_delay); |
| 2245 | |
| 2246 | -static bool phy_drv_supports_irq(struct phy_driver *phydrv) |
| 2247 | -{ |
| 2248 | - return phydrv->config_intr && phydrv->ack_interrupt; |
| 2249 | -} |
| 2250 | |
| 2251 | /** |
| 2252 | * phy_probe - probe and init a PHY device |
| 2253 | diff --git a/upstream/linux-5.10/drivers/net/zvnet/zvnet_dev.c b/upstream/linux-5.10/drivers/net/zvnet/zvnet_dev.c |
| 2254 | index c7da7a4..ffade7e 100755 |
| 2255 | --- a/upstream/linux-5.10/drivers/net/zvnet/zvnet_dev.c |
| 2256 | +++ b/upstream/linux-5.10/drivers/net/zvnet/zvnet_dev.c |
| 2257 | @@ -9,6 +9,8 @@ |
| 2258 | #include "ram_config.h"
|
| 2259 | #include <net/netfilter/nf_conntrack.h>
|
| 2260 | #include <net/SI/fast_common.h>
|
| 2261 | +#include <pub_debug_info.h>
|
| 2262 | +
|
| 2263 | /*******************************************************************************
|
| 2264 | * Macro definitions *
|
| 2265 | ******************************************************************************/
|
| 2266 | @@ -50,6 +52,18 @@ |
| 2267 | unsigned short flag;
|
| 2268 | struct T_zvnet_pkt_stats pkt[2];
|
| 2269 | };
|
| 2270 | +struct zvnet_arphdr {
|
| 2271 | + unsigned short ar_hrd; /* format of hardware address */
|
| 2272 | + unsigned short ar_pro; /* format of protocol address */
|
| 2273 | + unsigned char ar_hln; /* length of hardware address */
|
| 2274 | + unsigned char ar_pln; /* length of protocol address */
|
| 2275 | + unsigned short ar_op; /* ARP opcode (command) */
|
| 2276 | + unsigned char ar_sha[ETH_ALEN]; /* sender hardware address */
|
| 2277 | + unsigned char ar_sip[4]; /* sender IP address */
|
| 2278 | + unsigned char ar_tha[ETH_ALEN]; /* target hardware address */
|
| 2279 | + unsigned char ar_tip[4]; /* target IP address */
|
| 2280 | +};
|
| 2281 | +
|
| 2282 | /*******************************************************************************
|
| 2283 | * Local variable definitions *
|
| 2284 | ******************************************************************************/
|
| 2285 | @@ -65,6 +79,7 @@ |
| 2286 | struct semaphore g_zvnet_free_sem;
|
| 2287 | struct semaphore g_zvnet_xmit_sem;
|
| 2288 | struct sk_buff_head g_zvnet_skb_xmit_queue;
|
| 2289 | +atomic_t g_zvnet_pm_flag;
|
| 2290 |
|
| 2291 | unsigned int g_wrap_packet_size = 1000;
|
| 2292 | module_param(g_wrap_packet_size, int, 0644);
|
| 2293 | @@ -152,7 +167,7 @@ |
| 2294 | unsigned char *p = data;
|
| 2295 | for(i = 0; i < len && i < limit_len; i+=16)
|
| 2296 | {
|
| 2297 | - printk("0x%04x: %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n",i,
|
| 2298 | + printk("0x%04x: %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n",i,
|
| 2299 | p[0],p[1],p[2],p[3],p[4],p[5],p[6],p[7],
|
| 2300 | p[8],p[9],p[10],p[11],p[12],p[13],p[14],p[15]);
|
| 2301 | p += 16;
|
| 2302 | @@ -160,6 +175,11 @@ |
| 2303 | }
|
| 2304 | /* Ended by AICoder, pid:z5702yf8bad07ad1448a083e806dc31250b2418f */
|
| 2305 |
|
| 2306 | +void zvnet_set_pm_flag(unsigned int flag){
|
| 2307 | + if(flag & 0x100000)
|
| 2308 | + atomic_set(&g_zvnet_pm_flag, 1);
|
| 2309 | +}
|
| 2310 | +
|
| 2311 | int zvnet_get_index_by_netdev(struct net_device *net)
|
| 2312 | {
|
| 2313 | int i;
|
| 2314 | @@ -304,11 +324,127 @@ |
| 2315 | /* make sure we initialize shinfo sequentially */
|
| 2316 | skb_reset_network_header(skb);
|
| 2317 | skb_set_kcov_handle(skb, kcov_common_handle());
|
| 2318 | - if(unlikely(g_trace_limit > 0)){
|
| 2319 | - printk("-%s-dump_packet-start-%d\n", skb->dev->name, skb->len);
|
| 2320 | + if(unlikely(g_trace_limit & 1)){
|
| 2321 | + printk("-%s-dump_fromap-start-%d\n", skb->dev->name, skb->len);
|
| 2322 | zvnet_dump_packet(skb->data, skb->len, g_trace_limit);
|
| 2323 | - printk("-%s-dump_packet-end-\n", skb->dev->name);
|
| 2324 | + printk("-%s-dump_fromap-end-\n", skb->dev->name);
|
| 2325 | }
|
| 2326 | +/* Started by AICoder, pid:j2d34uccf7y1f37146a108290182771184940711 */
|
| 2327 | + if (atomic_read(&g_zvnet_pm_flag)) {
|
| 2328 | + unsigned short l2_hdr_len = 0;
|
| 2329 | + unsigned short h_proto = htons(*(unsigned short *)(skb->data + ETH_ALEN + ETH_ALEN));
|
| 2330 | + again:
|
| 2331 | + if (l2_hdr_len + ETH_HLEN < skb->len) {
|
| 2332 | + switch (h_proto) {
|
| 2333 | + case ETH_P_IP: {
|
| 2334 | + struct iphdr *iph = (struct iphdr *)(skb->data + ETH_HLEN + l2_hdr_len);
|
| 2335 | + if (iph->protocol == IPPROTO_TCP) {
|
| 2336 | + struct tcphdr *tcph = (struct tcphdr *)(((unsigned char *)iph) + iph->ihl * 4);
|
| 2337 | + char *flag;
|
| 2338 | + if (tcph->ack) {
|
| 2339 | + if (tcph->fin)
|
| 2340 | + flag = "FA";
|
| 2341 | + else if (tcph->syn)
|
| 2342 | + flag = "SA";
|
| 2343 | + else if (tcph->psh)
|
| 2344 | + flag = "PA";
|
| 2345 | + else
|
| 2346 | + flag = "A";
|
| 2347 | + } else {
|
| 2348 | + if (tcph->fin)
|
| 2349 | + flag = "F";
|
| 2350 | + else if (tcph->syn)
|
| 2351 | + flag = "S";
|
| 2352 | + else if (tcph->rst)
|
| 2353 | + flag = "R";
|
| 2354 | + else
|
| 2355 | + flag = "";
|
| 2356 | + }
|
| 2357 | + sc_debug_info_record("cap_net", "%u-%pI4-%pI4-%u%s %u:%u/%u\n",
|
| 2358 | + pbuf_temp->dev, &iph->saddr, &iph->daddr,
|
| 2359 | + iph->protocol, flag, ntohs(tcph->source), ntohs(tcph->dest), skb->len);
|
| 2360 | + } else if (iph->protocol == IPPROTO_UDP) {
|
| 2361 | + struct udphdr *udph = (struct udphdr *)(((unsigned char *)iph) + iph->ihl * 4);
|
| 2362 | + sc_debug_info_record("cap_net", "%u-%pI4-%pI4-%u %u:%u/%u\n",
|
| 2363 | + pbuf_temp->dev, &iph->saddr, &iph->daddr,
|
| 2364 | + iph->protocol, ntohs(udph->source), ntohs(udph->dest), skb->len);
|
| 2365 | + } else if (iph->protocol == IPPROTO_ICMP) {
|
| 2366 | + struct icmphdr *icmph = (struct icmphdr *)(((unsigned char *)iph) + iph->ihl * 4);
|
| 2367 | + sc_debug_info_record("cap_net", "%u-%pI4-%pI4-%u %u:%u/%u\n",
|
| 2368 | + pbuf_temp->dev, &iph->saddr, &iph->daddr,
|
| 2369 | + iph->protocol, icmph->type, icmph->code, skb->len);
|
| 2370 | + } else {
|
| 2371 | + sc_debug_info_record("cap_net", "%u-%pI4-%pI4-%u/%u\n",
|
| 2372 | + pbuf_temp->dev, &iph->saddr, &iph->daddr,
|
| 2373 | + iph->protocol, skb->len);
|
| 2374 | + }
|
| 2375 | + break;
|
| 2376 | + }
|
| 2377 | + case ETH_P_IPV6: {
|
| 2378 | + struct ipv6hdr *iph = (struct ipv6hdr *)(skb->data + ETH_HLEN + l2_hdr_len);
|
| 2379 | + if (iph->nexthdr == NEXTHDR_TCP) {
|
| 2380 | + struct tcphdr *tcph = (struct tcphdr *)(((unsigned char *)iph) + sizeof(struct ipv6hdr));
|
| 2381 | + char *flag;
|
| 2382 | + if (tcph->ack) {
|
| 2383 | + if (tcph->fin)
|
| 2384 | + flag = "FA";
|
| 2385 | + else if (tcph->syn)
|
| 2386 | + flag = "SA";
|
| 2387 | + else if (tcph->psh)
|
| 2388 | + flag = "PA";
|
| 2389 | + else
|
| 2390 | + flag = "A";
|
| 2391 | + } else {
|
| 2392 | + if (tcph->fin)
|
| 2393 | + flag = "F";
|
| 2394 | + else if (tcph->syn)
|
| 2395 | + flag = "S";
|
| 2396 | + else if (tcph->rst)
|
| 2397 | + flag = "R";
|
| 2398 | + else
|
| 2399 | + flag = "";
|
| 2400 | + }
|
| 2401 | + sc_debug_info_record("cap_net", "%u-%pI6-%pI6-%u%s %u:%u/%u\n",
|
| 2402 | + pbuf_temp->dev, iph->saddr.s6_addr32, iph->daddr.s6_addr32,
|
| 2403 | + iph->nexthdr, flag, ntohs(tcph->source), ntohs(tcph->dest), skb->len);
|
| 2404 | + } else if (iph->nexthdr == NEXTHDR_UDP) {
|
| 2405 | + struct udphdr *udph = (struct udphdr *)(((unsigned char *)iph) + sizeof(struct ipv6hdr));
|
| 2406 | + sc_debug_info_record("cap_net", "%u-%pI6-%pI6-%u %u:%u/%u\n",
|
| 2407 | + pbuf_temp->dev, iph->saddr.s6_addr32, iph->daddr.s6_addr32,
|
| 2408 | + iph->nexthdr, ntohs(udph->source), ntohs(udph->dest), skb->len);
|
| 2409 | + } else if (iph->nexthdr == NEXTHDR_ICMP) {
|
| 2410 | + struct icmp6hdr *icmph = (struct icmp6hdr *)(((unsigned char *)iph) + sizeof(struct ipv6hdr));
|
| 2411 | + sc_debug_info_record("cap_net", "%u-%pI6-%pI6-%u %u:%u/%u\n",
|
| 2412 | + pbuf_temp->dev, iph->saddr.s6_addr32, iph->daddr.s6_addr32,
|
| 2413 | + iph->nexthdr, icmph->icmp6_type, icmph->icmp6_code,skb->len);
|
| 2414 | + } else {
|
| 2415 | + sc_debug_info_record("cap_net", "%u-%pI6-%pI6-%u/%u\n",
|
| 2416 | + pbuf_temp->dev, iph->saddr.s6_addr32, iph->daddr.s6_addr32,
|
| 2417 | + iph->nexthdr, skb->len);
|
| 2418 | + }
|
| 2419 | + break;
|
| 2420 | + }
|
| 2421 | + case ETH_P_ARP: {
|
| 2422 | + struct zvnet_arphdr *arph = (struct zvnet_arphdr *)(skb->data + ETH_HLEN + l2_hdr_len);
|
| 2423 | + sc_debug_info_record("cap_net", "%u:%04x-%pI4-%pI4-%u/%u\n",
|
| 2424 | + pbuf_temp->dev, h_proto, arph->ar_sip, arph->ar_tip, htons(arph->ar_op), skb->len);
|
| 2425 | + break;
|
| 2426 | + }
|
| 2427 | + case ETH_P_8021Q: {
|
| 2428 | + struct vlan_hdr *vlanh = (struct vlan_hdr *)(skb->data + ETH_HLEN + l2_hdr_len);
|
| 2429 | + sc_debug_info_record("cap_net", "%u:%04x-%u\n",
|
| 2430 | + pbuf_temp->dev, h_proto, htons(vlanh->h_vlan_TCI) & VLAN_VID_MASK);
|
| 2431 | + l2_hdr_len += VLAN_HLEN;
|
| 2432 | + h_proto = htons(vlanh->h_vlan_encapsulated_proto);
|
| 2433 | + goto again;
|
| 2434 | + }
|
| 2435 | + default:
|
| 2436 | + sc_debug_info_record("cap_net", "%u:%04x/%u\n", pbuf_temp->dev, h_proto, skb->len);
|
| 2437 | + }
|
| 2438 | + }
|
| 2439 | + atomic_set(&g_zvnet_pm_flag, 0);
|
| 2440 | + }
|
| 2441 | +/* Ended by AICoder, pid:j2d34uccf7y1f37146a108290182771184940711 */
|
| 2442 | return skb;
|
| 2443 | }
|
| 2444 |
|
| 2445 | @@ -400,6 +536,11 @@ |
| 2446 | buff[i].len = skb->len;
|
| 2447 | buff[i].end_off = skb->end - skb->head;
|
| 2448 | buff[i].dev = zvnet_get_index_by_netdev(skb->dev);
|
| 2449 | + if(unlikely(g_trace_limit & 2)){
|
| 2450 | + printk("-%s-dump_toap-start-%d\n", skb->dev->name, skb->len);
|
| 2451 | + zvnet_dump_packet(skb->data, skb->len, g_trace_limit);
|
| 2452 | + printk("-%s-dump_toap-end-\n", skb->dev->name);
|
| 2453 | + }
|
| 2454 | if(skb->capHead){
|
| 2455 | buff[i].buff = skb->capHead;
|
| 2456 | #ifdef CONFIG_FASTNAT_MODULE
|
| 2457 | @@ -500,11 +641,11 @@ |
| 2458 | data->dev = net;
|
| 2459 | data->isToap = 1;
|
| 2460 | v7_dma_map_area(data->head, data->end - data->head + sizeof(struct skb_shared_info), DMA_TO_DEVICE);
|
| 2461 | + net->stats.tx_packets++;
|
| 2462 | + net->stats.tx_bytes += data->len;
|
| 2463 | skb_queue_tail(&g_zvnet_skb_xmit_queue, data);
|
| 2464 | if(data->len < g_wrap_packet_size || g_zvnet_skb_xmit_queue.qlen > g_wrap_num)
|
| 2465 | up(&g_zvnet_xmit_sem);
|
| 2466 | - net->stats.tx_packets++;
|
| 2467 | - net->stats.tx_bytes += skb->len;
|
| 2468 | #else
|
| 2469 | struct zvnet *dev = netdev_priv(net);
|
| 2470 | struct zvnet_device *zvnetdev = (struct zvnet_device *)dev->dev_priv;
|
| 2471 | @@ -1240,6 +1381,7 @@ |
| 2472 | struct net_device *net = NULL;
|
| 2473 | struct zvnet_device *zvnetdev = NULL;
|
| 2474 |
|
| 2475 | + atomic_set(&g_zvnet_pm_flag, 0);
|
| 2476 | #ifdef USE_ZVNET_PACKET
|
| 2477 | skb_queue_head_init(&g_zvnet_skb_xmit_queue);
|
| 2478 | spin_lock_init(&g_zvnet_free_lock);
|
| 2479 | diff --git a/upstream/linux-5.10/drivers/soc/sc/rpmsg/zx29_icp.c b/upstream/linux-5.10/drivers/soc/sc/rpmsg/zx29_icp.c |
| 2480 | index 3c5ba58..0e1ca16 100755 |
| 2481 | --- a/upstream/linux-5.10/drivers/soc/sc/rpmsg/zx29_icp.c |
| 2482 | +++ b/upstream/linux-5.10/drivers/soc/sc/rpmsg/zx29_icp.c |
| 2483 | @@ -324,7 +324,7 @@ |
| 2484 | [40] = "at channel 40", |
| 2485 | [41] = "voice buffer", |
| 2486 | }; |
| 2487 | - |
| 2488 | +extern void zvnet_set_pm_flag(unsigned int flag); |
| 2489 | void show_icp_state(T_ZDrvRpMsg_ActorID actorID) |
| 2490 | { |
| 2491 | unsigned int hw, lw; |
| 2492 | @@ -334,6 +334,7 @@ |
| 2493 | return; |
| 2494 | |
| 2495 | icp_get_int_info(actorID, &hw, &lw); |
| 2496 | + zvnet_set_pm_flag(lw); |
| 2497 | pr_info("[SLP] icpwake: 0x%x 0x%x\n", hw, lw); |
| 2498 | sc_debug_info_record(MODULE_ID_CAP_PM, " icpwake: 0x%x 0x%x\n", hw, lw); |
| 2499 | |
| 2500 | diff --git a/upstream/linux-5.10/drivers/tty/serial/zx29_uart.c b/upstream/linux-5.10/drivers/tty/serial/zx29_uart.c |
| 2501 | index b29437a..7029976 100755 |
| 2502 | --- a/upstream/linux-5.10/drivers/tty/serial/zx29_uart.c |
| 2503 | +++ b/upstream/linux-5.10/drivers/tty/serial/zx29_uart.c |
| 2504 | @@ -591,6 +591,48 @@ |
| 2505 | ); |
| 2506 | } |
| 2507 | DEVICE_ATTR(statics, S_IRUGO, statics_show, NULL); |
| 2508 | + |
| 2509 | +static unsigned int uart_io_seletc = 0; |
| 2510 | + |
| 2511 | + |
| 2512 | +static ssize_t uart_io_select_show(struct device *_dev, |
| 2513 | +struct device_attribute *attr, char *buf) |
| 2514 | +{ |
| 2515 | +struct platform_device *pdev = container_of(_dev, struct platform_device, dev); |
| 2516 | +//struct zx29_uart_platdata *pdata = pdev->dev.platform_data; |
| 2517 | + |
| 2518 | +return sprintf(buf, "%d\n",uart_io_seletc ); |
| 2519 | + |
| 2520 | +} |
| 2521 | + |
| 2522 | +static ssize_t uart_io_select_store(struct device *_dev, |
| 2523 | +struct device_attribute *attr, |
| 2524 | +const char *buf, size_t count) |
| 2525 | +{ |
| 2526 | + uint32_t flag = 0; |
| 2527 | +struct platform_device *pdev = container_of(_dev, struct platform_device, dev); |
| 2528 | +flag = simple_strtoul(buf, NULL, 16); |
| 2529 | + |
| 2530 | +if(flag == 1){ |
| 2531 | + printk("uart io is 1\n"); |
| 2532 | +pinctrl_pm_select_default_state(_dev); |
| 2533 | +}else if(flag == 0){ |
| 2534 | +pinctrl_pm_select_sleep_state(_dev); |
| 2535 | +} |
| 2536 | +else{ |
| 2537 | +printk("uart io select flag invaild\n"); |
| 2538 | +} |
| 2539 | + |
| 2540 | +uart_io_seletc = flag; |
| 2541 | + |
| 2542 | + |
| 2543 | + |
| 2544 | +return count; |
| 2545 | +} |
| 2546 | + |
| 2547 | +DEVICE_ATTR(uart_io_select, S_IRUGO | S_IWUSR, uart_io_select_show, |
| 2548 | + uart_io_select_store); |
| 2549 | + |
| 2550 | #define VEHICLE_USE_ONE_UART_LOG 1 |
| 2551 | #if VEHICLE_USE_ONE_UART_LOG |
| 2552 | #define ICP_CORE_ID_PS CORE_PS0 |
| 2553 | @@ -4412,6 +4454,9 @@ |
| 2554 | error = device_create_file(&pdev->dev, &dev_attr_app_ctrl); |
| 2555 | |
| 2556 | } |
| 2557 | + if(pdev->id == 2){ |
| 2558 | + error = device_create_file(&pdev->dev, &dev_attr_uart_io_select); |
| 2559 | + } |
| 2560 | error = device_create_file(&pdev->dev, &dev_attr_statics); |
| 2561 | device_init_wakeup(&pdev->dev, true); |
| 2562 | /* |
| 2563 | diff --git a/upstream/linux-5.10/include/linux/mfd/zx234290.h b/upstream/linux-5.10/include/linux/mfd/zx234290.h |
| 2564 | index ea89815..40e71bf 100755 |
| 2565 | --- a/upstream/linux-5.10/include/linux/mfd/zx234290.h |
| 2566 | +++ b/upstream/linux-5.10/include/linux/mfd/zx234290.h |
| 2567 | @@ -1009,24 +1009,6 @@ |
| 2568 | SINK_CURRENT_MAX |
| 2569 | }T_ZDrvZx234297_SINK_CURRENT; |
| 2570 | |
| 2571 | -typedef enum _T_ZDrvZx234290_ResetType |
| 2572 | -{ |
| 2573 | -#if 0 |
| 2574 | - ZX234290_USER_RST_UNDEFINE = 0, |
| 2575 | - ZX234290_USER_RST_TO_NORMAL = 1, |
| 2576 | - ZX234290_USER_RST_TO_CHARGER = 2, |
| 2577 | - ZX234290_USER_RST_TO_ALARM = 3, |
| 2578 | -#else |
| 2579 | - ZX234290_USER_RST_UNDEFINE = 3, |
| 2580 | - ZX234290_USER_RST_TO_NORMAL = 0, |
| 2581 | - ZX234290_USER_RST_TO_CHARGER = 1, |
| 2582 | - ZX234290_USER_RST_TO_ALARM = 2, |
| 2583 | -#endif |
| 2584 | - ZX234290_USER_RST_TO_EXCEPT = 4, |
| 2585 | - |
| 2586 | - ZX234290_USER_RST_MAX |
| 2587 | -}T_ZDrvZx234290_ResetType; |
| 2588 | - |
| 2589 | |
| 2590 | int zx234290_get_chip_version(void); |
| 2591 | int zx234290_irq_init(struct zx234290 *zx234290); |
| 2592 | diff --git a/upstream/linux-5.10/include/linux/mmc/mmc_func.h b/upstream/linux-5.10/include/linux/mmc/mmc_func.h |
| 2593 | index b2636ab..911c010 100755 |
| 2594 | --- a/upstream/linux-5.10/include/linux/mmc/mmc_func.h |
| 2595 | +++ b/upstream/linux-5.10/include/linux/mmc/mmc_func.h |
| 2596 | @@ -23,7 +23,7 @@ |
| 2597 | * data_size: the size of data you want to write .defined by byte |
| 2598 | * src_buf: data buffer where log or file stored; |
| 2599 | */ |
| 2600 | -int mmc_bwrite(u32 start_addr, u32 data_size, void *src_buf); |
| 2601 | +int mmc_bwrite(u64 start_addr, u32 data_size, void *src_buf); |
| 2602 | |
| 2603 | /* |
| 2604 | * start_addr: the address is the emmc address you want to write,and it size is |
| 2605 | @@ -32,6 +32,6 @@ |
| 2606 | * src_buf: data buffer where log or file will store; |
| 2607 | */ |
| 2608 | |
| 2609 | -int mmc_bread(u32 start_addr, u32 data_size, void *dst); |
| 2610 | +int mmc_bread(u64 start_addr, u32 data_size, void *dst); |
| 2611 | |
| 2612 | #endif /* LINUX_MMC_MMC_FUNC_H */ |
| 2613 | diff --git a/upstream/linux-5.10/kernel/ramdump/ramdump_client_cap.c b/upstream/linux-5.10/kernel/ramdump/ramdump_client_cap.c |
| 2614 | index bcb6a53..1492b49 100755 |
| 2615 | --- a/upstream/linux-5.10/kernel/ramdump/ramdump_client_cap.c |
| 2616 | +++ b/upstream/linux-5.10/kernel/ramdump/ramdump_client_cap.c |
| 2617 | @@ -45,6 +45,7 @@ |
| 2618 | extern void ramdump_data_transfer_to_device(void); |
| 2619 | extern void ramdump_oss_data_trans_init(void); |
| 2620 | extern unsigned char *ramdump_export_flag_base; |
| 2621 | +extern void zxic_reset_reason(int reason, const char *cpu, const char *app); |
| 2622 | |
| 2623 | /******************************************************************************* |
| 2624 | * ¾Ö²¿¾²Ì¬±äÁ¿¶¨Òå * |
| 2625 | @@ -71,7 +72,7 @@ |
| 2626 | unsigned char *ramdump_cap_error_log = NULL; |
| 2627 | unsigned int *cap_ddr_len_base = NULL; |
| 2628 | unsigned int sysctl_ramdump_emmc_size = 0x0; |
| 2629 | -unsigned int sysctl_ramdump_emmc_start_addr = 0xFFFF; |
| 2630 | +u64 sysctl_ramdump_emmc_start_addr = 0xFFFF; |
| 2631 | |
| 2632 | static struct ctl_table cfg_ramdump_array[] = { |
| 2633 | #ifdef CONFIG_RAMDUMP_USER |
| 2634 | @@ -128,7 +129,7 @@ |
| 2635 | { |
| 2636 | ramdump_msg_t *icp_msg = (ramdump_msg_t *)buf; |
| 2637 | |
| 2638 | - ramdump_server_exp_core = RAMDUMP_SUCCESS; |
| 2639 | + ramdump_server_exp_core = RAMDUMP_TRUE; |
| 2640 | |
| 2641 | switch(icp_msg->msg_id) |
| 2642 | { |
| 2643 | @@ -413,6 +414,9 @@ |
| 2644 | void ramdump_entry (void) |
| 2645 | { |
| 2646 | unsigned long flags; |
| 2647 | + |
| 2648 | + if (ramdump_server_exp_core == RAMDUMP_FALSE) |
| 2649 | + zxic_reset_reason(1, "cap", current->comm); /* not ap ramdump and cap ramdump */ |
| 2650 | if (sysctl_ramdump_on_panic == false) |
| 2651 | return; |
| 2652 | |
| 2653 | diff --git a/upstream/linux-5.10/kernel/ramdump/ramdump_device_trans.c b/upstream/linux-5.10/kernel/ramdump/ramdump_device_trans.c |
| 2654 | index f3e91e9..0b0f0dc 100755 |
| 2655 | --- a/upstream/linux-5.10/kernel/ramdump/ramdump_device_trans.c |
| 2656 | +++ b/upstream/linux-5.10/kernel/ramdump/ramdump_device_trans.c |
| 2657 | @@ -51,6 +51,8 @@ |
| 2658 | extern unsigned int ramdump_compress_flag; |
| 2659 | extern unsigned char *ramdump_log_buf; |
| 2660 | extern unsigned int ramdump_export_mode; |
| 2661 | +extern unsigned int ramdump_emmc_size; |
| 2662 | +extern unsigned int ramdump_spinand_size; |
| 2663 | |
| 2664 | /******************************************************************************* |
| 2665 | * Macro definitions * |
| 2666 | @@ -288,6 +290,8 @@ |
| 2667 | *******************************************************************************/ |
| 2668 | void ramdump_device_close(void) |
| 2669 | { |
| 2670 | + g_ramdump_dev_fp->file_num = ramdump_device_file_cnt; |
| 2671 | + |
| 2672 | if(ramdump_export_mode == RAMDUMP_MODE_EMMC) |
| 2673 | { |
| 2674 | #ifdef CONFIG_RAMDUMP_EMMC |
| 2675 | @@ -333,11 +337,16 @@ |
| 2676 | int ramdump_device_write_file(ramdump_trans_server_file_info_req *server_to_cap) |
| 2677 | { |
| 2678 | int ret = -1; |
| 2679 | + unsigned int file_size = 0; |
| 2680 | + |
| 2681 | + /* Started by AICoder, pid:wcfb91c2aa35add146d90b5530cd112845133621 */ |
| 2682 | + file_size = server_to_cap->file_size; |
| 2683 | |
| 2684 | if(ramdump_export_mode == RAMDUMP_MODE_EMMC) |
| 2685 | { |
| 2686 | #ifdef CONFIG_RAMDUMP_EMMC |
| 2687 | - if (ramdump_emmc_offset >= RAMDUMP_TRANS_EMMC_LEN) |
| 2688 | + if ((ramdump_emmc_offset >= RAMDUMP_TRANS_EMMC_LEN) |
| 2689 | + || ((ramdump_emmc_offset + file_size) > ramdump_emmc_size)) |
| 2690 | return -1; |
| 2691 | |
| 2692 | ret = ramdump_fill_header(server_to_cap->file_name, |
| 2693 | @@ -349,9 +358,11 @@ |
| 2694 | else if(ramdump_export_mode == RAMDUMP_MODE_SPINAND) |
| 2695 | { |
| 2696 | #ifdef CONFIG_MTD_SPI_NAND |
| 2697 | - if (ramdump_spinand_offset >= RAMDUMP_SPINAND_LEN) |
| 2698 | + if ((ramdump_spinand_offset >= RAMDUMP_SPINAND_LEN) |
| 2699 | + || ((ramdump_spinand_offset + file_size) > ramdump_spinand_size)) |
| 2700 | return -1; |
| 2701 | - |
| 2702 | + /* Ended by AICoder, pid:wcfb91c2aa35add146d90b5530cd112845133621 */ |
| 2703 | + |
| 2704 | ret = ramdump_fill_header(server_to_cap->file_name, |
| 2705 | server_to_cap->file_size, |
| 2706 | &ramdump_spinand_fp, |
| 2707 | @@ -557,9 +568,9 @@ |
| 2708 | int ramdump_device_write_data(ramdump_shmem_t *msg, unsigned int size, ssize_t *dstlen) |
| 2709 | { |
| 2710 | int ret = 0; |
| 2711 | - |
| 2712 | + |
| 2713 | if(ramdump_export_mode == RAMDUMP_MODE_EMMC) |
| 2714 | - { |
| 2715 | + { |
| 2716 | #ifdef CONFIG_RAMDUMP_EMMC |
| 2717 | ret = ramdump_emmc_write_data(msg, &ramdump_device_fp, size); |
| 2718 | if(ret < 0) |
| 2719 | @@ -637,8 +648,6 @@ |
| 2720 | ramdump_trans_server_interactive_req *server_to_cap_msg = (ramdump_trans_server_interactive_req *)req_buf; |
| 2721 | /* data from server to cap */ |
| 2722 | ramdump_file_num = server_to_cap_msg->file_num; |
| 2723 | - ramdump_device_fp.file_num += ramdump_file_num; |
| 2724 | - ramdump_spinand_fp.file_num += ramdump_file_num; |
| 2725 | |
| 2726 | /* data from cap to server */ |
| 2727 | cap_to_server_msg.cmd = RAMDUMP_PC_FILE_INFO_READ_REQ; |
| 2728 | @@ -658,8 +667,12 @@ |
| 2729 | /*device memory file create*/ |
| 2730 | if(ramdump_device_write_file(server_to_cap_msg) == -1){ |
| 2731 | cap_to_server_msg.cmd = RAMDUMP_PC_FILE_TRANS_DONE_REQ; |
| 2732 | - ramdump_device_write_file_head();//±£Ö¤³ö´íǰ¼¸¸öÎļþ¾ùд¶Ô¡£ |
| 2733 | - ramdump_printf("ramdump write emmc file error!\n"); |
| 2734 | + /* Started by AICoder, pid:ddd3ag3c37x6798145ec08ac1067150b58735197 */ |
| 2735 | + ramdump_oss_data_trans_write( |
| 2736 | + (unsigned char*)(&cap_to_server_msg), |
| 2737 | + sizeof(cap_to_server_msg)); |
| 2738 | + break; |
| 2739 | + /* Ended by AICoder, pid:ddd3ag3c37x6798145ec08ac1067150b58735197 */ |
| 2740 | } |
| 2741 | file_size = server_to_cap_msg->file_size; |
| 2742 | file_offset = 0; |
| 2743 | @@ -675,7 +688,8 @@ |
| 2744 | file_trans_size = cap_to_server_msg.length; |
| 2745 | file_left_size = file_left_size - cap_to_server_msg.length; |
| 2746 | file_offset = file_offset + cap_to_server_msg.length; |
| 2747 | - printk("device memory trans file:%s !!!\n", server_to_cap_msg->file_name); |
| 2748 | + |
| 2749 | + printk("device memory trans file:%-30s size %9d, offset %9d!!!\n", server_to_cap_msg->file_name, file_size, ramdump_emmc_offset); |
| 2750 | /* interactive data trans */ |
| 2751 | ramdump_oss_data_trans_write( |
| 2752 | (unsigned char*)(&cap_to_server_msg), |
| 2753 | @@ -690,14 +704,24 @@ |
| 2754 | /* data from server to cap */ |
| 2755 | ramdump_shmem_t *server_to_cap_msg = (ramdump_shmem_t *)ramdump_shared_mem_base; |
| 2756 | server_to_cap_msg->core_flag = 0; |
| 2757 | + |
| 2758 | /*data from cap to emmc*/ |
| 2759 | - |
| 2760 | write_len = ramdump_device_write_data(server_to_cap_msg, file_left_size, &file_dstlen); |
| 2761 | - if(write_len < 0) |
| 2762 | + if(write_len < 0 ) |
| 2763 | { |
| 2764 | - ramdump_printf("ramdump write emmc data error!\n"); |
| 2765 | + /* Started by AICoder, pid:u5befs8483y615f142ce0bda306d660bed685275 */ |
| 2766 | + if(write_len == -RAMDUMP_NO_FREE_SPACE) |
| 2767 | + { |
| 2768 | + cap_to_server_msg.cmd = RAMDUMP_PC_FILE_TRANS_DONE_REQ; |
| 2769 | + ramdump_oss_data_trans_write( |
| 2770 | + (unsigned char*)(&cap_to_server_msg), |
| 2771 | + sizeof(cap_to_server_msg)); |
| 2772 | + break; |
| 2773 | + } |
| 2774 | + else |
| 2775 | + ramdump_printf("ramdump write emmc data error!\n"); |
| 2776 | + /* Ended by AICoder, pid:u5befs8483y615f142ce0bda306d660bed685275 */ |
| 2777 | } |
| 2778 | - |
| 2779 | /*ÅжÏÊ£Óà´óС*/ |
| 2780 | if (file_left_size == 0) |
| 2781 | { |
| 2782 | diff --git a/upstream/linux-5.10/kernel/ramdump/ramdump_emmc.c b/upstream/linux-5.10/kernel/ramdump/ramdump_emmc.c |
| 2783 | index 0c28f27..5054440 100755 |
| 2784 | --- a/upstream/linux-5.10/kernel/ramdump/ramdump_emmc.c |
| 2785 | +++ b/upstream/linux-5.10/kernel/ramdump/ramdump_emmc.c |
| 2786 | @@ -128,16 +128,28 @@ |
| 2787 | int ramdump_emmc_write_data(ramdump_shmem_t *msg, ramdump_file_t *fp, unsigned int size) |
| 2788 | { |
| 2789 | int ret = 0; |
| 2790 | - unsigned int buffer = RAMDUMP_EMMC_ADDR + ramdump_emmc_offset; |
| 2791 | + u64 buffer = RAMDUMP_EMMC_ADDR + ramdump_emmc_offset; |
| 2792 | |
| 2793 | if (ramdump_device_file_cnt >= RAMDUMP_FILE_NUM_MAX) |
| 2794 | return -1; |
| 2795 | |
| 2796 | while(1){ |
| 2797 | if ((msg->core_flag == 1) && (msg->rw_flag == 2)){ |
| 2798 | - if(msg->size >= (ramdump_emmc_size - fp->file_fp[ramdump_device_file_cnt].offset)) |
| 2799 | - return -1; |
| 2800 | + /* Started by AICoder, pid:fe298k6b27edc1c14f9e0be2e0451e1abfc5830e */ |
| 2801 | + if((ramdump_emmc_size < ramdump_emmc_offset) |
| 2802 | + || (msg->size >= (ramdump_emmc_size - fp->file_fp[ramdump_device_file_cnt].offset))) |
| 2803 | + { |
| 2804 | + printk("[ramdump] No space left in emmc, Emmc_size is %ld,ramdump_emmc_offset is %d!\n", ramdump_emmc_size, ramdump_emmc_offset); |
| 2805 | + return -RAMDUMP_NO_FREE_SPACE; |
| 2806 | + } |
| 2807 | ret = mmc_bwrite(buffer, msg->size, msg->buf); |
| 2808 | + if(ret < 0) |
| 2809 | + { |
| 2810 | + printk("[ramdump] ramdump_emmc_write_data Error.\n"); |
| 2811 | + ramdump_wait_delay(0); |
| 2812 | + continue; |
| 2813 | + } |
| 2814 | + /* Ended by AICoder, pid:fe298k6b27edc1c14f9e0be2e0451e1abfc5830e */ |
| 2815 | ramdump_emmc_offset = ramdump_emmc_offset + roundup(msg->size, RAMDUMP_EMMC_ALIGN_SIZE); |
| 2816 | msg->core_flag = 1; |
| 2817 | msg->rw_flag = 1; |
| 2818 | diff --git a/upstream/linux-5.10/kernel/ramdump/ramdump_emmc.h b/upstream/linux-5.10/kernel/ramdump/ramdump_emmc.h |
| 2819 | index 1028ab2..6c9817e 100755 |
| 2820 | --- a/upstream/linux-5.10/kernel/ramdump/ramdump_emmc.h |
| 2821 | +++ b/upstream/linux-5.10/kernel/ramdump/ramdump_emmc.h |
| 2822 | @@ -24,13 +24,14 @@ |
| 2823 | /******************************************************************************* |
| 2824 | * Íⲿ±äÁ¿ÉùÃ÷ * |
| 2825 | *******************************************************************************/ |
| 2826 | -extern unsigned int sysctl_ramdump_emmc_start_addr; |
| 2827 | +extern u64 sysctl_ramdump_emmc_start_addr; |
| 2828 | extern unsigned int sysctl_ramdump_emmc_size; |
| 2829 | extern volatile unsigned int ramdump_emmc_offset; |
| 2830 | |
| 2831 | /******************************************************************************* |
| 2832 | * ºê¶¨Òå * |
| 2833 | *******************************************************************************/ |
| 2834 | +#define RAMDUMP_NO_FREE_SPACE (2) |
| 2835 | #define RAMDUMP_EMMC_ADDR (sysctl_ramdump_emmc_start_addr * 512) |
| 2836 | #define RAMDUMP_TRANS_EMMC_LEN (sysctl_ramdump_emmc_size * 512) |
| 2837 | |
| 2838 | diff --git a/upstream/linux-5.10/kernel/tracker.c b/upstream/linux-5.10/kernel/tracker.c |
| 2839 | index 6f7e1ab..792818b 100755 |
| 2840 | --- a/upstream/linux-5.10/kernel/tracker.c |
| 2841 | +++ b/upstream/linux-5.10/kernel/tracker.c |
| 2842 | @@ -63,6 +63,7 @@ |
| 2843 | #define OS_IRAM_SOFTIRQ_END (OS_IRAM_SOFTIRQ_START + sizeof(t_os_iram_statistic)) |
| 2844 | #define OS_IRAM_TIMER_START (OS_IRAM_SOFTIRQ_END + sizeof(t_os_iram_statistic)) |
| 2845 | #define OS_IRAM_TIMER_END (OS_IRAM_TIMER_START + sizeof(t_os_iram_statistic)) |
| 2846 | +#define OS_IRAM_RESET_REASON_START (OS_STATISTIC_IRAM_BASE + 0x800 - sizeof(T_Reset_Reason)) |
| 2847 | #endif |
| 2848 | |
| 2849 | #define os_statistic_check() *((volatile unsigned long *)OS_STATISTIC_IRAM_BASE) |
| 2850 | @@ -98,6 +99,12 @@ |
| 2851 | } statistics[OS_DDR_STATISTIC_CNT]; |
| 2852 | }t_os_ddr_statistic; |
| 2853 | |
| 2854 | +typedef struct |
| 2855 | +{ |
| 2856 | + char ramdump_reason[32]; //±ÈÈ磺ramdump_ap_appname |
| 2857 | + char kernel_reboot[32]; //±ÈÈ磺reboot_ap_appname |
| 2858 | +} T_Reset_Reason; |
| 2859 | + |
| 2860 | /******************************************************************************* |
| 2861 | * È«¾Ö±äÁ¿ * |
| 2862 | *******************************************************************************/ |
| 2863 | @@ -134,6 +141,7 @@ |
| 2864 | volatile static t_os_ddr_statistic *g_os_ddr_softirq_end_statistic; |
| 2865 | volatile static t_os_ddr_statistic *g_os_ddr_timer_start_statistic; |
| 2866 | volatile static t_os_ddr_statistic *g_os_ddr_timer_end_statistic; |
| 2867 | +volatile T_Reset_Reason *g_os_reset_reason; |
| 2868 | #endif |
| 2869 | |
| 2870 | /******************************************************************************* |
| 2871 | @@ -418,7 +426,32 @@ |
| 2872 | os_statistic_in_ddr(g_os_ddr_timer_end_statistic, func, time); |
| 2873 | os_statistic_info_update(); |
| 2874 | } |
| 2875 | +/* |
| 2876 | +reason: 1 for ramdump, 2 for reboot |
| 2877 | +cpu: ap/cap/rpm/phy |
| 2878 | +app: current->comm |
| 2879 | +*/ |
| 2880 | +/* Started by AICoder, pid:pf139dce4f7776c149ec081b508bae14e6084ede */ |
| 2881 | +void zxic_reset_reason(int reason, const char *cpu, const char *app) |
| 2882 | +{ |
| 2883 | + char buffer[32]; |
| 2884 | |
| 2885 | + memset(buffer, 0, sizeof(buffer)); |
| 2886 | + switch (reason) |
| 2887 | + { |
| 2888 | + case 1: |
| 2889 | + snprintf(buffer, 32, "reset_ramdump_%s_%s", cpu, app); |
| 2890 | + memcpy(g_os_reset_reason->ramdump_reason, buffer, sizeof(buffer)); |
| 2891 | + break; |
| 2892 | + case 2: |
| 2893 | + snprintf(buffer, 32, "reset_kreboot_%s_%s", cpu, app); |
| 2894 | + memcpy(g_os_reset_reason->kernel_reboot, buffer, sizeof(buffer)); |
| 2895 | + break; |
| 2896 | + default: |
| 2897 | + break; |
| 2898 | + } |
| 2899 | +} |
| 2900 | +/* Ended by AICoder, pid:pf139dce4f7776c149ec081b508bae14e6084ede */ |
| 2901 | |
| 2902 | /******************************************************************************* |
| 2903 | * ¹¦ÄÜÃèÊö: ¹ì¼£Í³¼Æµ½DDR |
| 2904 | @@ -438,9 +471,10 @@ |
| 2905 | #ifdef IRAM_BASE_ADDR_VA |
| 2906 | g_zxic_trace_apcpu_addr = IRAM_BASE_ADDR_OS_STATISTIC_PSCPU; |
| 2907 | #else |
| 2908 | - g_zxic_trace_apcpu_addr = ioremap(IRAM_BASE_ADDR_OS_STATISTIC_PSCPU, IRAM_BASE_LEN_OS_STATISTIC_PSCPU); |
| 2909 | + g_zxic_trace_apcpu_addr = ioremap(IRAM_BASE_ADDR_OS_STATISTIC_PSCPU, IRAM_BASE_LEN_OS_STATISTIC_PSCPU + IRAM_BASE_LEN_OS_STATISTIC_PHYCPU + IRAM_BASE_LEN_OS_STATISTIC_APCPU); |
| 2910 | #endif |
| 2911 | |
| 2912 | + g_os_reset_reason = (T_Reset_Reason *)OS_IRAM_RESET_REASON_START; |
| 2913 | /* |
| 2914 | init_timer(&timer); |
| 2915 | timer.expires = jiffies + 40*HZ;//msecs_to_jiffies(40*1000);//ÑÓ³Ù40Ãë |
| 2916 | diff --git a/upstream/linux-5.10/sound/soc/sanechips/zx29_ak4940.c b/upstream/linux-5.10/sound/soc/sanechips/zx29_ak4940.c |
| 2917 | index f730067..efdfe9e 100755 |
| 2918 | --- a/upstream/linux-5.10/sound/soc/sanechips/zx29_ak4940.c |
| 2919 | +++ b/upstream/linux-5.10/sound/soc/sanechips/zx29_ak4940.c |
| 2920 | @@ -37,6 +37,7 @@ |
| 2921 | |
| 2922 | |
| 2923 | #include "i2s.h" |
| 2924 | +#include "pub_debug_info.h" |
| 2925 | |
| 2926 | #define ZX29_I2S_TOP_LOOP_REG 0xac |
| 2927 | |
| 2928 | @@ -362,48 +363,97 @@ |
| 2929 | |
| 2930 | #endif |
| 2931 | |
| 2932 | - static int zx29startup(struct snd_pcm_substream *substream) |
| 2933 | - { |
| 2934 | - // int ret = 0; |
| 2935 | - print_audio("Alsa Entered func %s\n", __func__); |
| 2936 | - //CPPS_FUNC(cpps_callbacks, zDrv_Audio_Printf)("Alsa: zx29_startup device=%d,stream=%d\n", substream->pcm->device, substream->stream); |
| 2937 | +/* Started by AICoder, pid:r53959b7c94916e146e3093b301a356223b009fa */ |
| 2938 | +static int zx29startup(struct snd_pcm_substream *substream) |
| 2939 | +{ |
| 2940 | + //int ret = 0; |
| 2941 | + print_audio("Alsa Entered func %s\n", __func__); |
| 2942 | + //CPPS_FUNC(cpps_callbacks, zDrv_Audio_Printf)("Alsa: zx29_startup device=%d,stream=%d\n", substream->pcm->device, substream->stream); |
| 2943 | + |
| 2944 | + struct snd_pcm *pcmC0D0p = snd_lookup_minor_data(16, SNDRV_DEVICE_TYPE_PCM_PLAYBACK); |
| 2945 | + struct snd_pcm *pcmC0D1p = snd_lookup_minor_data(17, SNDRV_DEVICE_TYPE_PCM_PLAYBACK); |
| 2946 | + struct snd_pcm *pcmC0D2p = snd_lookup_minor_data(18, SNDRV_DEVICE_TYPE_PCM_PLAYBACK); |
| 2947 | + struct snd_pcm *pcmC0D3p = snd_lookup_minor_data(19, SNDRV_DEVICE_TYPE_PCM_PLAYBACK); |
| 2948 | + //struct snd_pcm *pcmC0D4p = snd_lookup_minor_data(20, SNDRV_DEVICE_TYPE_PCM_PLAYBACK); |
| 2949 | |
| 2950 | - struct snd_pcm *pcmC0D0p = snd_lookup_minor_data(16, SNDRV_DEVICE_TYPE_PCM_PLAYBACK); |
| 2951 | - struct snd_pcm *pcmC0D1p = snd_lookup_minor_data(17, SNDRV_DEVICE_TYPE_PCM_PLAYBACK); |
| 2952 | - struct snd_pcm *pcmC0D2p = snd_lookup_minor_data(18, SNDRV_DEVICE_TYPE_PCM_PLAYBACK); |
| 2953 | - struct snd_pcm *pcmC0D3p = snd_lookup_minor_data(19, SNDRV_DEVICE_TYPE_PCM_PLAYBACK); |
| 2954 | - if ((pcmC0D0p == NULL) || (pcmC0D1p == NULL) || (pcmC0D2p == NULL) || (pcmC0D3p == NULL)) |
| 2955 | - return -EINVAL; |
| 2956 | - if ((pcmC0D0p->streams[0].substream_opened && pcmC0D1p->streams[0].substream_opened) || |
| 2957 | - (pcmC0D0p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) || |
| 2958 | - (pcmC0D0p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) || |
| 2959 | - (pcmC0D1p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) || |
| 2960 | - (pcmC0D1p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) || |
| 2961 | - (pcmC0D2p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened)) |
| 2962 | - BUG(); |
| 2963 | + struct snd_pcm *pcmC0D0c = snd_lookup_minor_data(24, SNDRV_DEVICE_TYPE_PCM_CAPTURE); |
| 2964 | + struct snd_pcm *pcmC0D1c = snd_lookup_minor_data(25, SNDRV_DEVICE_TYPE_PCM_CAPTURE); |
| 2965 | + struct snd_pcm *pcmC0D2c = snd_lookup_minor_data(26, SNDRV_DEVICE_TYPE_PCM_CAPTURE); |
| 2966 | + struct snd_pcm *pcmC0D3c = snd_lookup_minor_data(27, SNDRV_DEVICE_TYPE_PCM_CAPTURE); |
| 2967 | + //struct snd_pcm *pcmC0D4c = snd_lookup_minor_data(28, SNDRV_DEVICE_TYPE_PCM_CAPTURE); |
| 2968 | + |
| 2969 | + if ((pcmC0D0p == NULL) || (pcmC0D1p == NULL) || (pcmC0D2p == NULL) || (pcmC0D3p == NULL)) |
| 2970 | + { |
| 2971 | + print_audio("Alsa Entered func %s, pcmC0D0p=%p, pcmC0D1p=%p, pcmC0D2p=%p, pcmC0D3p=%p\n", __func__, |
| 2972 | + pcmC0D0p, pcmC0D1p, pcmC0D2p, pcmC0D3p); |
| 2973 | + return -EINVAL; |
| 2974 | + } |
| 2975 | + if ((pcmC0D0p->streams[0].substream_opened && pcmC0D1p->streams[0].substream_opened) || |
| 2976 | + (pcmC0D0p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) || |
| 2977 | + (pcmC0D0p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) || |
| 2978 | + (pcmC0D1p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) || |
| 2979 | + (pcmC0D1p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) || |
| 2980 | + (pcmC0D2p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened)) |
| 2981 | + { |
| 2982 | + print_audio("Alsa Entered func %s error busy, pcmC0D0p.opened=%d, pcmC0D1p.opened=%d, pcmC0D2p.opened=%d, pcmC0D3p.opened=%d\n", |
| 2983 | + __func__, pcmC0D0p->streams[0].substream_opened, pcmC0D1p->streams[0].substream_opened, |
| 2984 | + pcmC0D2p->streams[0].substream_opened, pcmC0D3p->streams[0].substream_opened); |
| 2985 | + sc_debug_info_record(MODULE_ID_CAP_AUDIO, "Alsa %s err, opened value pcmC0D0p=%d, pcmC0D1p=%d, pcmC0D2p=%d, pcmC0D3p=%d\n", |
| 2986 | + __func__, pcmC0D0p->streams[0].substream_opened, pcmC0D1p->streams[0].substream_opened, |
| 2987 | + pcmC0D2p->streams[0].substream_opened, pcmC0D3p->streams[0].substream_opened); |
| 2988 | + |
| 2989 | + return -EBUSY; |
| 2990 | + //BUG(); |
| 2991 | + } |
| 2992 | + |
| 2993 | + if ((pcmC0D0c == NULL) || (pcmC0D1c == NULL) || (pcmC0D2c == NULL) || (pcmC0D3c == NULL)) |
| 2994 | + { |
| 2995 | + print_audio("Alsa Entered func %s, pcmC0D0c=%p, pcmC0D1c=%p, pcmC0D2c=%p, pcmC0D3c=%p\n", __func__, |
| 2996 | + pcmC0D0c, pcmC0D1c, pcmC0D2c, pcmC0D3c); |
| 2997 | + return -EINVAL; |
| 2998 | + } |
| 2999 | + if ((pcmC0D0c->streams[1].substream_opened && pcmC0D1c->streams[1].substream_opened) || |
| 3000 | + (pcmC0D0c->streams[1].substream_opened && pcmC0D2c->streams[1].substream_opened) || |
| 3001 | + (pcmC0D0c->streams[1].substream_opened && pcmC0D3c->streams[1].substream_opened) || |
| 3002 | + (pcmC0D1c->streams[1].substream_opened && pcmC0D2c->streams[1].substream_opened) || |
| 3003 | + (pcmC0D1c->streams[1].substream_opened && pcmC0D3c->streams[1].substream_opened) || |
| 3004 | + (pcmC0D2c->streams[1].substream_opened && pcmC0D3c->streams[1].substream_opened)) |
| 3005 | + { |
| 3006 | + print_audio("Alsa Entered func %s error busy, pcmC0D0c.opened=%d, pcmC0D1c.opened=%d, pcmC0D2c.opened=%d,pcmC0D3c.opened=%d\n", |
| 3007 | + __func__, pcmC0D0c->streams[1].substream_opened, pcmC0D1c->streams[1].substream_opened, |
| 3008 | + pcmC0D2c->streams[1].substream_opened, pcmC0D3c->streams[1].substream_opened,); |
| 3009 | + sc_debug_info_record(MODULE_ID_CAP_AUDIO, "Alsa %s err, opened value pcmC0D0c=%d, pcmC0D1c=%d, pcmC0D2c=%d, pcmC0D3c=%d\n", |
| 3010 | + __func__, pcmC0D0c->streams[1].substream_opened, pcmC0D1c->streams[1].substream_opened, |
| 3011 | + pcmC0D2c->streams[1].substream_opened, pcmC0D3c->streams[1].substream_opened); |
| 3012 | + |
| 3013 | + return -EBUSY; |
| 3014 | + //BUG(); |
| 3015 | + } |
| 3016 | + |
| 3017 | #if 0 |
| 3018 | - unsigned long flags; |
| 3019 | - if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { |
| 3020 | - gpio_set_value(ZX29_GPIO_125, GPIO_LOW); |
| 3021 | - mdelay(1); |
| 3022 | - |
| 3023 | - raw_spin_lock_irqsave(&codec_pa_lock, flags); |
| 3024 | - gpio_set_value(ZX29_GPIO_125, GPIO_HIGH); |
| 3025 | - udelay(2); |
| 3026 | - gpio_set_value(ZX29_GPIO_125, GPIO_LOW); |
| 3027 | - udelay(2); |
| 3028 | - gpio_set_value(ZX29_GPIO_125, GPIO_HIGH); |
| 3029 | - udelay(2); |
| 3030 | - gpio_set_value(ZX29_GPIO_125, GPIO_LOW); |
| 3031 | - udelay(2); |
| 3032 | - gpio_set_value(ZX29_GPIO_125, GPIO_HIGH); |
| 3033 | - raw_spin_unlock_irqrestore(&codec_pa_lock, flags); |
| 3034 | - } |
| 3035 | + unsigned long flags; |
| 3036 | + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { |
| 3037 | + gpio_set_value(ZX29_GPIO_125, GPIO_LOW); |
| 3038 | + mdelay(1); |
| 3039 | + |
| 3040 | + raw_spin_lock_irqsave(&codec_pa_lock, flags); |
| 3041 | + gpio_set_value(ZX29_GPIO_125, GPIO_HIGH); |
| 3042 | + udelay(2); |
| 3043 | + gpio_set_value(ZX29_GPIO_125, GPIO_LOW); |
| 3044 | + udelay(2); |
| 3045 | + gpio_set_value(ZX29_GPIO_125, GPIO_HIGH); |
| 3046 | + udelay(2); |
| 3047 | + gpio_set_value(ZX29_GPIO_125, GPIO_LOW); |
| 3048 | + udelay(2); |
| 3049 | + gpio_set_value(ZX29_GPIO_125, GPIO_HIGH); |
| 3050 | + raw_spin_unlock_irqrestore(&codec_pa_lock, flags); |
| 3051 | + } |
| 3052 | #endif |
| 3053 | |
| 3054 | - |
| 3055 | - return 0; |
| 3056 | - } |
| 3057 | + |
| 3058 | + return 0; |
| 3059 | +} |
| 3060 | +/* Ended by AICoder, pid:r53959b7c94916e146e3093b301a356223b009fa */ |
| 3061 | |
| 3062 | static void zx29_shutdown(struct snd_pcm_substream *substream) |
| 3063 | { |
| 3064 | diff --git a/upstream/linux-5.10/sound/soc/sanechips/zx29_dummycodec.c b/upstream/linux-5.10/sound/soc/sanechips/zx29_dummycodec.c |
| 3065 | index 1a8cf3e..ff07416 100755 |
| 3066 | --- a/upstream/linux-5.10/sound/soc/sanechips/zx29_dummycodec.c |
| 3067 | +++ b/upstream/linux-5.10/sound/soc/sanechips/zx29_dummycodec.c |
| 3068 | @@ -36,6 +36,7 @@ |
| 3069 | |
| 3070 | |
| 3071 | #include "i2s.h" |
| 3072 | +#include "pub_debug_info.h" |
| 3073 | |
| 3074 | #define ZX29_I2S_TOP_LOOP_REG 0x60 |
| 3075 | |
| 3076 | @@ -361,53 +362,102 @@ |
| 3077 | |
| 3078 | #endif |
| 3079 | |
| 3080 | - static int zx29startup(struct snd_pcm_substream *substream) |
| 3081 | - { |
| 3082 | - // int ret = 0; |
| 3083 | - print_audio("Alsa Entered func %s\n", __func__); |
| 3084 | - //CPPS_FUNC(cpps_callbacks, zDrv_Audio_Printf)("Alsa: zx29_startup device=%d,stream=%d\n", substream->pcm->device, substream->stream); |
| 3085 | +/* Started by AICoder, pid:53525s2951m0dfb1406409962017998611b17cc1 */ |
| 3086 | +static int zx29startup(struct snd_pcm_substream *substream) |
| 3087 | +{ |
| 3088 | + //int ret = 0; |
| 3089 | + print_audio("Alsa Entered func %s\n", __func__); |
| 3090 | + //CPPS_FUNC(cpps_callbacks, zDrv_Audio_Printf)("Alsa: zx29_startup device=%d,stream=%d\n", substream->pcm->device, substream->stream); |
| 3091 | + |
| 3092 | + struct snd_pcm *pcmC0D0p = snd_lookup_minor_data(16, SNDRV_DEVICE_TYPE_PCM_PLAYBACK); |
| 3093 | + struct snd_pcm *pcmC0D1p = snd_lookup_minor_data(17, SNDRV_DEVICE_TYPE_PCM_PLAYBACK); |
| 3094 | + struct snd_pcm *pcmC0D2p = snd_lookup_minor_data(18, SNDRV_DEVICE_TYPE_PCM_PLAYBACK); |
| 3095 | + struct snd_pcm *pcmC0D3p = snd_lookup_minor_data(19, SNDRV_DEVICE_TYPE_PCM_PLAYBACK); |
| 3096 | + //struct snd_pcm *pcmC0D4p = snd_lookup_minor_data(20, SNDRV_DEVICE_TYPE_PCM_PLAYBACK); |
| 3097 | |
| 3098 | - struct snd_pcm *pcmC0D0p = snd_lookup_minor_data(16, SNDRV_DEVICE_TYPE_PCM_PLAYBACK); |
| 3099 | - struct snd_pcm *pcmC0D1p = snd_lookup_minor_data(17, SNDRV_DEVICE_TYPE_PCM_PLAYBACK); |
| 3100 | - struct snd_pcm *pcmC0D2p = snd_lookup_minor_data(18, SNDRV_DEVICE_TYPE_PCM_PLAYBACK); |
| 3101 | - struct snd_pcm *pcmC0D3p = snd_lookup_minor_data(19, SNDRV_DEVICE_TYPE_PCM_PLAYBACK); |
| 3102 | - if ((pcmC0D0p == NULL) || (pcmC0D1p == NULL) || (pcmC0D2p == NULL) || (pcmC0D3p == NULL)) |
| 3103 | - return -EINVAL; |
| 3104 | - if ((pcmC0D0p->streams[0].substream_opened && pcmC0D1p->streams[0].substream_opened) || |
| 3105 | - (pcmC0D0p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) || |
| 3106 | - (pcmC0D0p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) || |
| 3107 | - (pcmC0D1p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) || |
| 3108 | - (pcmC0D1p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) || |
| 3109 | - (pcmC0D2p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened)) |
| 3110 | - BUG(); |
| 3111 | + struct snd_pcm *pcmC0D0c = snd_lookup_minor_data(24, SNDRV_DEVICE_TYPE_PCM_CAPTURE); |
| 3112 | + struct snd_pcm *pcmC0D1c = snd_lookup_minor_data(25, SNDRV_DEVICE_TYPE_PCM_CAPTURE); |
| 3113 | + struct snd_pcm *pcmC0D2c = snd_lookup_minor_data(26, SNDRV_DEVICE_TYPE_PCM_CAPTURE); |
| 3114 | + struct snd_pcm *pcmC0D3c = snd_lookup_minor_data(27, SNDRV_DEVICE_TYPE_PCM_CAPTURE); |
| 3115 | + //struct snd_pcm *pcmC0D4c = snd_lookup_minor_data(28, SNDRV_DEVICE_TYPE_PCM_CAPTURE); |
| 3116 | + |
| 3117 | + if ((pcmC0D0p == NULL) || (pcmC0D1p == NULL) || (pcmC0D2p == NULL) || (pcmC0D3p == NULL)) |
| 3118 | + { |
| 3119 | + print_audio("Alsa Entered func %s, pcmC0D0p=%p, pcmC0D1p=%p, pcmC0D2p=%p, pcmC0D3p=%p\n", __func__, |
| 3120 | + pcmC0D0p, pcmC0D1p, pcmC0D2p, pcmC0D3p); |
| 3121 | + return -EINVAL; |
| 3122 | + } |
| 3123 | + if ((pcmC0D0p->streams[0].substream_opened && pcmC0D1p->streams[0].substream_opened) || |
| 3124 | + (pcmC0D0p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) || |
| 3125 | + (pcmC0D0p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) || |
| 3126 | + (pcmC0D1p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) || |
| 3127 | + (pcmC0D1p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) || |
| 3128 | + (pcmC0D2p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened)) |
| 3129 | + { |
| 3130 | + print_audio("Alsa Entered func %s error busy, pcmC0D0p.opened=%d, pcmC0D1p.opened=%d, pcmC0D2p.opened=%d, pcmC0D3p.opened=%d\n", |
| 3131 | + __func__, pcmC0D0p->streams[0].substream_opened, pcmC0D1p->streams[0].substream_opened, |
| 3132 | + pcmC0D2p->streams[0].substream_opened, pcmC0D3p->streams[0].substream_opened); |
| 3133 | + sc_debug_info_record(MODULE_ID_CAP_AUDIO, "Alsa %s err, opened value pcmC0D0p=%d, pcmC0D1p=%d, pcmC0D2p=%d, pcmC0D3p=%d\n", |
| 3134 | + __func__, pcmC0D0p->streams[0].substream_opened, pcmC0D1p->streams[0].substream_opened, |
| 3135 | + pcmC0D2p->streams[0].substream_opened, pcmC0D3p->streams[0].substream_opened); |
| 3136 | + |
| 3137 | + return -EBUSY; |
| 3138 | + //BUG(); |
| 3139 | + } |
| 3140 | + |
| 3141 | + if ((pcmC0D0c == NULL) || (pcmC0D1c == NULL) || (pcmC0D2c == NULL) || (pcmC0D3c == NULL)) |
| 3142 | + { |
| 3143 | + print_audio("Alsa Entered func %s, pcmC0D0c=%p, pcmC0D1c=%p, pcmC0D2c=%p, pcmC0D3c=%p\n", __func__, |
| 3144 | + pcmC0D0c, pcmC0D1c, pcmC0D2c, pcmC0D3c); |
| 3145 | + return -EINVAL; |
| 3146 | + } |
| 3147 | + if ((pcmC0D0c->streams[1].substream_opened && pcmC0D1c->streams[1].substream_opened) || |
| 3148 | + (pcmC0D0c->streams[1].substream_opened && pcmC0D2c->streams[1].substream_opened) || |
| 3149 | + (pcmC0D0c->streams[1].substream_opened && pcmC0D3c->streams[1].substream_opened) || |
| 3150 | + (pcmC0D1c->streams[1].substream_opened && pcmC0D2c->streams[1].substream_opened) || |
| 3151 | + (pcmC0D1c->streams[1].substream_opened && pcmC0D3c->streams[1].substream_opened) || |
| 3152 | + (pcmC0D2c->streams[1].substream_opened && pcmC0D3c->streams[1].substream_opened)) |
| 3153 | + { |
| 3154 | + print_audio("Alsa Entered func %s error busy, pcmC0D0c.opened=%d, pcmC0D1c.opened=%d, pcmC0D2c.opened=%d,pcmC0D3c.opened=%d\n", |
| 3155 | + __func__, pcmC0D0c->streams[1].substream_opened, pcmC0D1c->streams[1].substream_opened, |
| 3156 | + pcmC0D2c->streams[1].substream_opened, pcmC0D3c->streams[1].substream_opened); |
| 3157 | + sc_debug_info_record(MODULE_ID_CAP_AUDIO, "Alsa %s err, opened value pcmC0D0c=%d, pcmC0D1c=%d, pcmC0D2c=%d, pcmC0D3c=%d\n", |
| 3158 | + __func__, pcmC0D0c->streams[1].substream_opened, pcmC0D1c->streams[1].substream_opened, |
| 3159 | + pcmC0D2c->streams[1].substream_opened, pcmC0D3c->streams[1].substream_opened); |
| 3160 | + |
| 3161 | + return -EBUSY; |
| 3162 | + //BUG(); |
| 3163 | + } |
| 3164 | + |
| 3165 | #if 0 |
| 3166 | - unsigned long flags; |
| 3167 | - if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { |
| 3168 | - gpio_set_value(ZX29_GPIO_125, GPIO_LOW); |
| 3169 | - mdelay(1); |
| 3170 | - |
| 3171 | - raw_spin_lock_irqsave(&codec_pa_lock, flags); |
| 3172 | - gpio_set_value(ZX29_GPIO_125, GPIO_HIGH); |
| 3173 | - udelay(2); |
| 3174 | - gpio_set_value(ZX29_GPIO_125, GPIO_LOW); |
| 3175 | - udelay(2); |
| 3176 | - gpio_set_value(ZX29_GPIO_125, GPIO_HIGH); |
| 3177 | - udelay(2); |
| 3178 | - gpio_set_value(ZX29_GPIO_125, GPIO_LOW); |
| 3179 | - udelay(2); |
| 3180 | - gpio_set_value(ZX29_GPIO_125, GPIO_HIGH); |
| 3181 | - raw_spin_unlock_irqrestore(&codec_pa_lock, flags); |
| 3182 | - } |
| 3183 | + unsigned long flags; |
| 3184 | + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { |
| 3185 | + gpio_set_value(ZX29_GPIO_125, GPIO_LOW); |
| 3186 | + mdelay(1); |
| 3187 | + |
| 3188 | + raw_spin_lock_irqsave(&codec_pa_lock, flags); |
| 3189 | + gpio_set_value(ZX29_GPIO_125, GPIO_HIGH); |
| 3190 | + udelay(2); |
| 3191 | + gpio_set_value(ZX29_GPIO_125, GPIO_LOW); |
| 3192 | + udelay(2); |
| 3193 | + gpio_set_value(ZX29_GPIO_125, GPIO_HIGH); |
| 3194 | + udelay(2); |
| 3195 | + gpio_set_value(ZX29_GPIO_125, GPIO_LOW); |
| 3196 | + udelay(2); |
| 3197 | + gpio_set_value(ZX29_GPIO_125, GPIO_HIGH); |
| 3198 | + raw_spin_unlock_irqrestore(&codec_pa_lock, flags); |
| 3199 | + } |
| 3200 | #endif |
| 3201 | - |
| 3202 | - unsigned int armRegBit = 0; |
| 3203 | - //armRegBit = zx_read_reg(AON_WIFI_BT_CLK_CFG2); |
| 3204 | - //armRegBit &= 0xfffffffe; |
| 3205 | - //armRegBit |= 0x1; |
| 3206 | - //zx_write_reg(AON_WIFI_BT_CLK_CFG2, armRegBit); |
| 3207 | - |
| 3208 | - return 0; |
| 3209 | - } |
| 3210 | + |
| 3211 | + unsigned int armRegBit = 0; |
| 3212 | + //armRegBit = zx_read_reg(AON_WIFI_BT_CLK_CFG2); |
| 3213 | + //armRegBit &= 0xfffffffe; |
| 3214 | + //armRegBit |= 0x1; |
| 3215 | + //zx_write_reg(AON_WIFI_BT_CLK_CFG2, armRegBit); |
| 3216 | + |
| 3217 | + return 0; |
| 3218 | +} |
| 3219 | +/* Ended by AICoder, pid:53525s2951m0dfb1406409962017998611b17cc1 */ |
| 3220 | |
| 3221 | static void zx29_shutdown(struct snd_pcm_substream *substream) |
| 3222 | { |
| 3223 | diff --git a/upstream/linux-5.10/sound/soc/sanechips/zx29_es83xx.c b/upstream/linux-5.10/sound/soc/sanechips/zx29_es83xx.c |
| 3224 | index 1204542..0aaf23f 100755 |
| 3225 | --- a/upstream/linux-5.10/sound/soc/sanechips/zx29_es83xx.c |
| 3226 | +++ b/upstream/linux-5.10/sound/soc/sanechips/zx29_es83xx.c |
| 3227 | @@ -39,6 +39,7 @@ |
| 3228 | |
| 3229 | |
| 3230 | #include "i2s.h" |
| 3231 | +#include "pub_debug_info.h" |
| 3232 | |
| 3233 | #define ZX29_I2S_TOP_LOOP_REG 0x60 |
| 3234 | //#define NAU_CLK_ID 0 |
| 3235 | @@ -101,29 +102,97 @@ |
| 3236 | struct snd_ctl_elem_value *ucontrol); |
| 3237 | |
| 3238 | |
| 3239 | - static int zx29startup(struct snd_pcm_substream *substream) |
| 3240 | - { |
| 3241 | - // int ret = 0; |
| 3242 | - print_audio("Alsa Entered func %s\n", __func__); |
| 3243 | - //CPPS_FUNC(cpps_callbacks, zDrv_Audio_Printf)("Alsa: zx29_startup device=%d,stream=%d\n", substream->pcm->device, substream->stream); |
| 3244 | +/* Started by AICoder, pid:i3fd98546erae28145550ba82095535ff4895652 */ |
| 3245 | +static int zx29startup(struct snd_pcm_substream *substream) |
| 3246 | +{ |
| 3247 | + //int ret = 0; |
| 3248 | + print_audio("Alsa Entered func %s\n", __func__); |
| 3249 | + //CPPS_FUNC(cpps_callbacks, zDrv_Audio_Printf)("Alsa: zx29_startup device=%d,stream=%d\n", substream->pcm->device, substream->stream); |
| 3250 | + |
| 3251 | + struct snd_pcm *pcmC0D0p = snd_lookup_minor_data(16, SNDRV_DEVICE_TYPE_PCM_PLAYBACK); |
| 3252 | + struct snd_pcm *pcmC0D1p = snd_lookup_minor_data(17, SNDRV_DEVICE_TYPE_PCM_PLAYBACK); |
| 3253 | + struct snd_pcm *pcmC0D2p = snd_lookup_minor_data(18, SNDRV_DEVICE_TYPE_PCM_PLAYBACK); |
| 3254 | + struct snd_pcm *pcmC0D3p = snd_lookup_minor_data(19, SNDRV_DEVICE_TYPE_PCM_PLAYBACK); |
| 3255 | + //struct snd_pcm *pcmC0D4p = snd_lookup_minor_data(20, SNDRV_DEVICE_TYPE_PCM_PLAYBACK); |
| 3256 | |
| 3257 | - struct snd_pcm *pcmC0D0p = snd_lookup_minor_data(16, SNDRV_DEVICE_TYPE_PCM_PLAYBACK); |
| 3258 | - struct snd_pcm *pcmC0D1p = snd_lookup_minor_data(17, SNDRV_DEVICE_TYPE_PCM_PLAYBACK); |
| 3259 | - struct snd_pcm *pcmC0D2p = snd_lookup_minor_data(18, SNDRV_DEVICE_TYPE_PCM_PLAYBACK); |
| 3260 | - struct snd_pcm *pcmC0D3p = snd_lookup_minor_data(19, SNDRV_DEVICE_TYPE_PCM_PLAYBACK); |
| 3261 | - if ((pcmC0D0p == NULL) || (pcmC0D1p == NULL) || (pcmC0D2p == NULL) || (pcmC0D3p == NULL)) |
| 3262 | - return -EINVAL; |
| 3263 | - if ((pcmC0D0p->streams[0].substream_opened && pcmC0D1p->streams[0].substream_opened) || |
| 3264 | - (pcmC0D0p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) || |
| 3265 | - (pcmC0D0p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) || |
| 3266 | - (pcmC0D1p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) || |
| 3267 | - (pcmC0D1p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) || |
| 3268 | - (pcmC0D2p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened)) |
| 3269 | - BUG(); |
| 3270 | + struct snd_pcm *pcmC0D0c = snd_lookup_minor_data(24, SNDRV_DEVICE_TYPE_PCM_CAPTURE); |
| 3271 | + struct snd_pcm *pcmC0D1c = snd_lookup_minor_data(25, SNDRV_DEVICE_TYPE_PCM_CAPTURE); |
| 3272 | + struct snd_pcm *pcmC0D2c = snd_lookup_minor_data(26, SNDRV_DEVICE_TYPE_PCM_CAPTURE); |
| 3273 | + struct snd_pcm *pcmC0D3c = snd_lookup_minor_data(27, SNDRV_DEVICE_TYPE_PCM_CAPTURE); |
| 3274 | + //struct snd_pcm *pcmC0D4c = snd_lookup_minor_data(28, SNDRV_DEVICE_TYPE_PCM_CAPTURE); |
| 3275 | + |
| 3276 | + if ((pcmC0D0p == NULL) || (pcmC0D1p == NULL) || (pcmC0D2p == NULL) || (pcmC0D3p == NULL)) |
| 3277 | + { |
| 3278 | + print_audio("Alsa Entered func %s, pcmC0D0p=%p, pcmC0D1p=%p, pcmC0D2p=%p, pcmC0D3p=%p\n", __func__, |
| 3279 | + pcmC0D0p, pcmC0D1p, pcmC0D2p, pcmC0D3p); |
| 3280 | + return -EINVAL; |
| 3281 | + } |
| 3282 | + if ((pcmC0D0p->streams[0].substream_opened && pcmC0D1p->streams[0].substream_opened) || |
| 3283 | + (pcmC0D0p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) || |
| 3284 | + (pcmC0D0p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) || |
| 3285 | + (pcmC0D1p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) || |
| 3286 | + (pcmC0D1p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) || |
| 3287 | + (pcmC0D2p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened)) |
| 3288 | + { |
| 3289 | + print_audio("Alsa Entered func %s error busy, pcmC0D0p.opened=%d, pcmC0D1p.opened=%d, pcmC0D2p.opened=%d, pcmC0D3p.opened=%d\n", |
| 3290 | + __func__, pcmC0D0p->streams[0].substream_opened, pcmC0D1p->streams[0].substream_opened, |
| 3291 | + pcmC0D2p->streams[0].substream_opened, pcmC0D3p->streams[0].substream_opened); |
| 3292 | + sc_debug_info_record(MODULE_ID_CAP_AUDIO, "Alsa %s err, opened value pcmC0D0p=%d, pcmC0D1p=%d, pcmC0D2p=%d, pcmC0D3p=%d\n", |
| 3293 | + __func__, pcmC0D0p->streams[0].substream_opened, pcmC0D1p->streams[0].substream_opened, |
| 3294 | + pcmC0D2p->streams[0].substream_opened, pcmC0D3p->streams[0].substream_opened); |
| 3295 | + |
| 3296 | + return -EBUSY; |
| 3297 | + //BUG(); |
| 3298 | + } |
| 3299 | + |
| 3300 | + if ((pcmC0D0c == NULL) || (pcmC0D1c == NULL) || (pcmC0D2c == NULL) || (pcmC0D3c == NULL)) |
| 3301 | + { |
| 3302 | + print_audio("Alsa Entered func %s, pcmC0D0c=%p, pcmC0D1c=%p, pcmC0D2c=%p, pcmC0D3c=%p\n", __func__, |
| 3303 | + pcmC0D0c, pcmC0D1c, pcmC0D2c, pcmC0D3c); |
| 3304 | + return -EINVAL; |
| 3305 | + } |
| 3306 | + if ((pcmC0D0c->streams[1].substream_opened && pcmC0D1c->streams[1].substream_opened) || |
| 3307 | + (pcmC0D0c->streams[1].substream_opened && pcmC0D2c->streams[1].substream_opened) || |
| 3308 | + (pcmC0D0c->streams[1].substream_opened && pcmC0D3c->streams[1].substream_opened) || |
| 3309 | + (pcmC0D1c->streams[1].substream_opened && pcmC0D2c->streams[1].substream_opened) || |
| 3310 | + (pcmC0D1c->streams[1].substream_opened && pcmC0D3c->streams[1].substream_opened) || |
| 3311 | + (pcmC0D2c->streams[1].substream_opened && pcmC0D3c->streams[1].substream_opened)) |
| 3312 | + { |
| 3313 | + print_audio("Alsa Entered func %s error busy, pcmC0D0c.opened=%d, pcmC0D1c.opened=%d, pcmC0D2c.opened=%d,pcmC0D3c.opened=%d\n", |
| 3314 | + __func__, pcmC0D0c->streams[1].substream_opened, pcmC0D1c->streams[1].substream_opened, |
| 3315 | + pcmC0D2c->streams[1].substream_opened, pcmC0D3c->streams[1].substream_opened); |
| 3316 | + sc_debug_info_record(MODULE_ID_CAP_AUDIO, "Alsa %s err, opened value pcmC0D0c=%d, pcmC0D1c=%d, pcmC0D2c=%d, pcmC0D3c=%d\n", |
| 3317 | + __func__, pcmC0D0c->streams[1].substream_opened, pcmC0D1c->streams[1].substream_opened, |
| 3318 | + pcmC0D2c->streams[1].substream_opened, pcmC0D3c->streams[1].substream_opened); |
| 3319 | + |
| 3320 | + return -EBUSY; |
| 3321 | + //BUG(); |
| 3322 | + } |
| 3323 | |
| 3324 | - |
| 3325 | - return 0; |
| 3326 | - } |
| 3327 | +#if 0 |
| 3328 | + unsigned long flags; |
| 3329 | + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { |
| 3330 | + gpio_set_value(ZX29_GPIO_125, GPIO_LOW); |
| 3331 | + mdelay(1); |
| 3332 | + |
| 3333 | + raw_spin_lock_irqsave(&codec_pa_lock, flags); |
| 3334 | + gpio_set_value(ZX29_GPIO_125, GPIO_HIGH); |
| 3335 | + udelay(2); |
| 3336 | + gpio_set_value(ZX29_GPIO_125, GPIO_LOW); |
| 3337 | + udelay(2); |
| 3338 | + gpio_set_value(ZX29_GPIO_125, GPIO_HIGH); |
| 3339 | + udelay(2); |
| 3340 | + gpio_set_value(ZX29_GPIO_125, GPIO_LOW); |
| 3341 | + udelay(2); |
| 3342 | + gpio_set_value(ZX29_GPIO_125, GPIO_HIGH); |
| 3343 | + raw_spin_unlock_irqrestore(&codec_pa_lock, flags); |
| 3344 | + } |
| 3345 | +#endif |
| 3346 | + |
| 3347 | + |
| 3348 | + return 0; |
| 3349 | +} |
| 3350 | +/* Ended by AICoder, pid:i3fd98546erae28145550ba82095535ff4895652 */ |
| 3351 | |
| 3352 | static void zx29_shutdown(struct snd_pcm_substream *substream) |
| 3353 | { |
| 3354 | diff --git a/upstream/linux-5.10/sound/soc/sanechips/zx29_max9867.c b/upstream/linux-5.10/sound/soc/sanechips/zx29_max9867.c |
| 3355 | index ea874ee..7cb0c36 100755 |
| 3356 | --- a/upstream/linux-5.10/sound/soc/sanechips/zx29_max9867.c |
| 3357 | +++ b/upstream/linux-5.10/sound/soc/sanechips/zx29_max9867.c |
| 3358 | @@ -37,6 +37,7 @@ |
| 3359 | |
| 3360 | |
| 3361 | #include "i2s.h" |
| 3362 | +#include "pub_debug_info.h" |
| 3363 | |
| 3364 | #define ZX29_I2S_TOP_LOOP_REG 0x60 |
| 3365 | #define CODEC_CLK_ID 0 |
| 3366 | @@ -371,48 +372,97 @@ |
| 3367 | |
| 3368 | |
| 3369 | |
| 3370 | - static int zx29startup(struct snd_pcm_substream *substream) |
| 3371 | - { |
| 3372 | - // int ret = 0; |
| 3373 | - print_audio("Alsa Entered func %s\n", __func__); |
| 3374 | - //CPPS_FUNC(cpps_callbacks, zDrv_Audio_Printf)("Alsa: zx29_startup device=%d,stream=%d\n", substream->pcm->device, substream->stream); |
| 3375 | +/* Started by AICoder, pid:g33a6vccc4k69881474b0948e0153c719773e1fe */ |
| 3376 | +static int zx29startup(struct snd_pcm_substream *substream) |
| 3377 | +{ |
| 3378 | + //int ret = 0; |
| 3379 | + print_audio("Alsa Entered func %s\n", __func__); |
| 3380 | + //CPPS_FUNC(cpps_callbacks, zDrv_Audio_Printf)("Alsa: zx29_startup device=%d,stream=%d\n", substream->pcm->device, substream->stream); |
| 3381 | + |
| 3382 | + struct snd_pcm *pcmC0D0p = snd_lookup_minor_data(16, SNDRV_DEVICE_TYPE_PCM_PLAYBACK); |
| 3383 | + struct snd_pcm *pcmC0D1p = snd_lookup_minor_data(17, SNDRV_DEVICE_TYPE_PCM_PLAYBACK); |
| 3384 | + struct snd_pcm *pcmC0D2p = snd_lookup_minor_data(18, SNDRV_DEVICE_TYPE_PCM_PLAYBACK); |
| 3385 | + struct snd_pcm *pcmC0D3p = snd_lookup_minor_data(19, SNDRV_DEVICE_TYPE_PCM_PLAYBACK); |
| 3386 | + //struct snd_pcm *pcmC0D4p = snd_lookup_minor_data(20, SNDRV_DEVICE_TYPE_PCM_PLAYBACK); |
| 3387 | |
| 3388 | - struct snd_pcm *pcmC0D0p = snd_lookup_minor_data(16, SNDRV_DEVICE_TYPE_PCM_PLAYBACK); |
| 3389 | - struct snd_pcm *pcmC0D1p = snd_lookup_minor_data(17, SNDRV_DEVICE_TYPE_PCM_PLAYBACK); |
| 3390 | - struct snd_pcm *pcmC0D2p = snd_lookup_minor_data(18, SNDRV_DEVICE_TYPE_PCM_PLAYBACK); |
| 3391 | - struct snd_pcm *pcmC0D3p = snd_lookup_minor_data(19, SNDRV_DEVICE_TYPE_PCM_PLAYBACK); |
| 3392 | - if ((pcmC0D0p == NULL) || (pcmC0D1p == NULL) || (pcmC0D2p == NULL) || (pcmC0D3p == NULL)) |
| 3393 | - return -EINVAL; |
| 3394 | - if ((pcmC0D0p->streams[0].substream_opened && pcmC0D1p->streams[0].substream_opened) || |
| 3395 | - (pcmC0D0p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) || |
| 3396 | - (pcmC0D0p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) || |
| 3397 | - (pcmC0D1p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) || |
| 3398 | - (pcmC0D1p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) || |
| 3399 | - (pcmC0D2p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened)) |
| 3400 | - BUG(); |
| 3401 | + struct snd_pcm *pcmC0D0c = snd_lookup_minor_data(24, SNDRV_DEVICE_TYPE_PCM_CAPTURE); |
| 3402 | + struct snd_pcm *pcmC0D1c = snd_lookup_minor_data(25, SNDRV_DEVICE_TYPE_PCM_CAPTURE); |
| 3403 | + struct snd_pcm *pcmC0D2c = snd_lookup_minor_data(26, SNDRV_DEVICE_TYPE_PCM_CAPTURE); |
| 3404 | + struct snd_pcm *pcmC0D3c = snd_lookup_minor_data(27, SNDRV_DEVICE_TYPE_PCM_CAPTURE); |
| 3405 | + //struct snd_pcm *pcmC0D4c = snd_lookup_minor_data(28, SNDRV_DEVICE_TYPE_PCM_CAPTURE); |
| 3406 | + |
| 3407 | + if ((pcmC0D0p == NULL) || (pcmC0D1p == NULL) || (pcmC0D2p == NULL) || (pcmC0D3p == NULL)) |
| 3408 | + { |
| 3409 | + print_audio("Alsa Entered func %s, pcmC0D0p=%p, pcmC0D1p=%p, pcmC0D2p=%p, pcmC0D3p=%p\n", __func__, |
| 3410 | + pcmC0D0p, pcmC0D1p, pcmC0D2p, pcmC0D3p); |
| 3411 | + return -EINVAL; |
| 3412 | + } |
| 3413 | + if ((pcmC0D0p->streams[0].substream_opened && pcmC0D1p->streams[0].substream_opened) || |
| 3414 | + (pcmC0D0p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) || |
| 3415 | + (pcmC0D0p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) || |
| 3416 | + (pcmC0D1p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) || |
| 3417 | + (pcmC0D1p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) || |
| 3418 | + (pcmC0D2p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened)) |
| 3419 | + { |
| 3420 | + print_audio("Alsa Entered func %s error busy, pcmC0D0p.opened=%d, pcmC0D1p.opened=%d, pcmC0D2p.opened=%d, pcmC0D3p.opened=%d\n", |
| 3421 | + __func__, pcmC0D0p->streams[0].substream_opened, pcmC0D1p->streams[0].substream_opened, |
| 3422 | + pcmC0D2p->streams[0].substream_opened, pcmC0D3p->streams[0].substream_opened); |
| 3423 | + sc_debug_info_record(MODULE_ID_CAP_AUDIO, "Alsa %s err, opened value pcmC0D0p=%d, pcmC0D1p=%d, pcmC0D2p=%d, pcmC0D3p=%d\n", |
| 3424 | + __func__, pcmC0D0p->streams[0].substream_opened, pcmC0D1p->streams[0].substream_opened, |
| 3425 | + pcmC0D2p->streams[0].substream_opened, pcmC0D3p->streams[0].substream_opened); |
| 3426 | + |
| 3427 | + return -EBUSY; |
| 3428 | + //BUG(); |
| 3429 | + } |
| 3430 | + |
| 3431 | + if ((pcmC0D0c == NULL) || (pcmC0D1c == NULL) || (pcmC0D2c == NULL) || (pcmC0D3c == NULL)) |
| 3432 | + { |
| 3433 | + print_audio("Alsa Entered func %s, pcmC0D0c=%p, pcmC0D1c=%p, pcmC0D2c=%p, pcmC0D3c=%p\n", __func__, |
| 3434 | + pcmC0D0c, pcmC0D1c, pcmC0D2c, pcmC0D3c); |
| 3435 | + return -EINVAL; |
| 3436 | + } |
| 3437 | + if ((pcmC0D0c->streams[1].substream_opened && pcmC0D1c->streams[1].substream_opened) || |
| 3438 | + (pcmC0D0c->streams[1].substream_opened && pcmC0D2c->streams[1].substream_opened) || |
| 3439 | + (pcmC0D0c->streams[1].substream_opened && pcmC0D3c->streams[1].substream_opened) || |
| 3440 | + (pcmC0D1c->streams[1].substream_opened && pcmC0D2c->streams[1].substream_opened) || |
| 3441 | + (pcmC0D1c->streams[1].substream_opened && pcmC0D3c->streams[1].substream_opened) || |
| 3442 | + (pcmC0D2c->streams[1].substream_opened && pcmC0D3c->streams[1].substream_opened)) |
| 3443 | + { |
| 3444 | + print_audio("Alsa Entered func %s error busy, pcmC0D0c.opened=%d, pcmC0D1c.opened=%d, pcmC0D2c.opened=%d,pcmC0D3c.opened=%d\n", |
| 3445 | + __func__, pcmC0D0c->streams[1].substream_opened, pcmC0D1c->streams[1].substream_opened, |
| 3446 | + pcmC0D2c->streams[1].substream_opened, pcmC0D3c->streams[1].substream_opened); |
| 3447 | + sc_debug_info_record(MODULE_ID_CAP_AUDIO, "Alsa %s err, opened value pcmC0D0c=%d, pcmC0D1c=%d, pcmC0D2c=%d, pcmC0D3c=%d\n", |
| 3448 | + __func__, pcmC0D0c->streams[1].substream_opened, pcmC0D1c->streams[1].substream_opened, |
| 3449 | + pcmC0D2c->streams[1].substream_opened, pcmC0D3c->streams[1].substream_opened; |
| 3450 | + |
| 3451 | + return -EBUSY; |
| 3452 | + //BUG(); |
| 3453 | + } |
| 3454 | + |
| 3455 | #if 0 |
| 3456 | - unsigned long flags; |
| 3457 | - if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { |
| 3458 | - gpio_set_value(ZX29_GPIO_125, GPIO_LOW); |
| 3459 | - mdelay(1); |
| 3460 | - |
| 3461 | - raw_spin_lock_irqsave(&codec_pa_lock, flags); |
| 3462 | - gpio_set_value(ZX29_GPIO_125, GPIO_HIGH); |
| 3463 | - udelay(2); |
| 3464 | - gpio_set_value(ZX29_GPIO_125, GPIO_LOW); |
| 3465 | - udelay(2); |
| 3466 | - gpio_set_value(ZX29_GPIO_125, GPIO_HIGH); |
| 3467 | - udelay(2); |
| 3468 | - gpio_set_value(ZX29_GPIO_125, GPIO_LOW); |
| 3469 | - udelay(2); |
| 3470 | - gpio_set_value(ZX29_GPIO_125, GPIO_HIGH); |
| 3471 | - raw_spin_unlock_irqrestore(&codec_pa_lock, flags); |
| 3472 | - } |
| 3473 | + unsigned long flags; |
| 3474 | + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { |
| 3475 | + gpio_set_value(ZX29_GPIO_125, GPIO_LOW); |
| 3476 | + mdelay(1); |
| 3477 | + |
| 3478 | + raw_spin_lock_irqsave(&codec_pa_lock, flags); |
| 3479 | + gpio_set_value(ZX29_GPIO_125, GPIO_HIGH); |
| 3480 | + udelay(2); |
| 3481 | + gpio_set_value(ZX29_GPIO_125, GPIO_LOW); |
| 3482 | + udelay(2); |
| 3483 | + gpio_set_value(ZX29_GPIO_125, GPIO_HIGH); |
| 3484 | + udelay(2); |
| 3485 | + gpio_set_value(ZX29_GPIO_125, GPIO_LOW); |
| 3486 | + udelay(2); |
| 3487 | + gpio_set_value(ZX29_GPIO_125, GPIO_HIGH); |
| 3488 | + raw_spin_unlock_irqrestore(&codec_pa_lock, flags); |
| 3489 | + } |
| 3490 | #endif |
| 3491 | - |
| 3492 | - |
| 3493 | - return 0; |
| 3494 | - } |
| 3495 | + |
| 3496 | + |
| 3497 | + return 0; |
| 3498 | +} |
| 3499 | +/* Ended by AICoder, pid:g33a6vccc4k69881474b0948e0153c719773e1fe */ |
| 3500 | |
| 3501 | static void zx29_shutdown(struct snd_pcm_substream *substream) |
| 3502 | { |
| 3503 | diff --git a/upstream/linux-5.10/sound/soc/sanechips/zx29_nau8810.c b/upstream/linux-5.10/sound/soc/sanechips/zx29_nau8810.c |
| 3504 | index 1e5777d..4dc8672 100755 |
| 3505 | --- a/upstream/linux-5.10/sound/soc/sanechips/zx29_nau8810.c |
| 3506 | +++ b/upstream/linux-5.10/sound/soc/sanechips/zx29_nau8810.c |
| 3507 | @@ -37,6 +37,7 @@ |
| 3508 | |
| 3509 | |
| 3510 | #include "i2s.h" |
| 3511 | +#include "pub_debug_info.h" |
| 3512 | |
| 3513 | #define ZX29_I2S_TOP_LOOP_REG 0x60 |
| 3514 | #define NAU_CLK_ID 0 |
| 3515 | @@ -373,48 +374,97 @@ |
| 3516 | |
| 3517 | |
| 3518 | |
| 3519 | - static int zx29startup(struct snd_pcm_substream *substream) |
| 3520 | - { |
| 3521 | - // int ret = 0; |
| 3522 | - print_audio("Alsa Entered func %s\n", __func__); |
| 3523 | - //CPPS_FUNC(cpps_callbacks, zDrv_Audio_Printf)("Alsa: zx29_startup device=%d,stream=%d\n", substream->pcm->device, substream->stream); |
| 3524 | +/* Started by AICoder, pid:we8d34d80fbc7981449d0b1590d6b753b789d779 */ |
| 3525 | +static int zx29startup(struct snd_pcm_substream *substream) |
| 3526 | +{ |
| 3527 | + //int ret = 0; |
| 3528 | + print_audio("Alsa Entered func %s\n", __func__); |
| 3529 | + //CPPS_FUNC(cpps_callbacks, zDrv_Audio_Printf)("Alsa: zx29_startup device=%d,stream=%d\n", substream->pcm->device, substream->stream); |
| 3530 | + |
| 3531 | + struct snd_pcm *pcmC0D0p = snd_lookup_minor_data(16, SNDRV_DEVICE_TYPE_PCM_PLAYBACK); |
| 3532 | + struct snd_pcm *pcmC0D1p = snd_lookup_minor_data(17, SNDRV_DEVICE_TYPE_PCM_PLAYBACK); |
| 3533 | + struct snd_pcm *pcmC0D2p = snd_lookup_minor_data(18, SNDRV_DEVICE_TYPE_PCM_PLAYBACK); |
| 3534 | + struct snd_pcm *pcmC0D3p = snd_lookup_minor_data(19, SNDRV_DEVICE_TYPE_PCM_PLAYBACK); |
| 3535 | + //struct snd_pcm *pcmC0D4p = snd_lookup_minor_data(20, SNDRV_DEVICE_TYPE_PCM_PLAYBACK); |
| 3536 | |
| 3537 | - struct snd_pcm *pcmC0D0p = snd_lookup_minor_data(16, SNDRV_DEVICE_TYPE_PCM_PLAYBACK); |
| 3538 | - struct snd_pcm *pcmC0D1p = snd_lookup_minor_data(17, SNDRV_DEVICE_TYPE_PCM_PLAYBACK); |
| 3539 | - struct snd_pcm *pcmC0D2p = snd_lookup_minor_data(18, SNDRV_DEVICE_TYPE_PCM_PLAYBACK); |
| 3540 | - struct snd_pcm *pcmC0D3p = snd_lookup_minor_data(19, SNDRV_DEVICE_TYPE_PCM_PLAYBACK); |
| 3541 | - if ((pcmC0D0p == NULL) || (pcmC0D1p == NULL) || (pcmC0D2p == NULL) || (pcmC0D3p == NULL)) |
| 3542 | - return -EINVAL; |
| 3543 | - if ((pcmC0D0p->streams[0].substream_opened && pcmC0D1p->streams[0].substream_opened) || |
| 3544 | - (pcmC0D0p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) || |
| 3545 | - (pcmC0D0p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) || |
| 3546 | - (pcmC0D1p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) || |
| 3547 | - (pcmC0D1p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) || |
| 3548 | - (pcmC0D2p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened)) |
| 3549 | - BUG(); |
| 3550 | + struct snd_pcm *pcmC0D0c = snd_lookup_minor_data(24, SNDRV_DEVICE_TYPE_PCM_CAPTURE); |
| 3551 | + struct snd_pcm *pcmC0D1c = snd_lookup_minor_data(25, SNDRV_DEVICE_TYPE_PCM_CAPTURE); |
| 3552 | + struct snd_pcm *pcmC0D2c = snd_lookup_minor_data(26, SNDRV_DEVICE_TYPE_PCM_CAPTURE); |
| 3553 | + struct snd_pcm *pcmC0D3c = snd_lookup_minor_data(27, SNDRV_DEVICE_TYPE_PCM_CAPTURE); |
| 3554 | + //struct snd_pcm *pcmC0D4c = snd_lookup_minor_data(28, SNDRV_DEVICE_TYPE_PCM_CAPTURE); |
| 3555 | + |
| 3556 | + if ((pcmC0D0p == NULL) || (pcmC0D1p == NULL) || (pcmC0D2p == NULL) || (pcmC0D3p == NULL)) |
| 3557 | + { |
| 3558 | + print_audio("Alsa Entered func %s, pcmC0D0p=%p, pcmC0D1p=%p, pcmC0D2p=%p, pcmC0D3p=%p\n", __func__, |
| 3559 | + pcmC0D0p, pcmC0D1p, pcmC0D2p, pcmC0D3p); |
| 3560 | + return -EINVAL; |
| 3561 | + } |
| 3562 | + if ((pcmC0D0p->streams[0].substream_opened && pcmC0D1p->streams[0].substream_opened) || |
| 3563 | + (pcmC0D0p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) || |
| 3564 | + (pcmC0D0p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) || |
| 3565 | + (pcmC0D1p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) || |
| 3566 | + (pcmC0D1p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) || |
| 3567 | + (pcmC0D2p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened)) |
| 3568 | + { |
| 3569 | + print_audio("Alsa Entered func %s error busy, pcmC0D0p.opened=%d, pcmC0D1p.opened=%d, pcmC0D2p.opened=%d, pcmC0D3p.opened=%d\n", |
| 3570 | + __func__, pcmC0D0p->streams[0].substream_opened, pcmC0D1p->streams[0].substream_opened, |
| 3571 | + pcmC0D2p->streams[0].substream_opened, pcmC0D3p->streams[0].substream_opened); |
| 3572 | + sc_debug_info_record(MODULE_ID_CAP_AUDIO, "Alsa %s err, opened value pcmC0D0p=%d, pcmC0D1p=%d, pcmC0D2p=%d, pcmC0D3p=%d\n", |
| 3573 | + __func__, pcmC0D0p->streams[0].substream_opened, pcmC0D1p->streams[0].substream_opened, |
| 3574 | + pcmC0D2p->streams[0].substream_opened, pcmC0D3p->streams[0].substream_opened); |
| 3575 | + |
| 3576 | + return -EBUSY; |
| 3577 | + //BUG(); |
| 3578 | + } |
| 3579 | + |
| 3580 | + if ((pcmC0D0c == NULL) || (pcmC0D1c == NULL) || (pcmC0D2c == NULL) || (pcmC0D3c == NULL)) |
| 3581 | + { |
| 3582 | + print_audio("Alsa Entered func %s, pcmC0D0c=%p, pcmC0D1c=%p, pcmC0D2c=%p, pcmC0D3c=%p\n", __func__, |
| 3583 | + pcmC0D0c, pcmC0D1c, pcmC0D2c, pcmC0D3c); |
| 3584 | + return -EINVAL; |
| 3585 | + } |
| 3586 | + if ((pcmC0D0c->streams[1].substream_opened && pcmC0D1c->streams[1].substream_opened) || |
| 3587 | + (pcmC0D0c->streams[1].substream_opened && pcmC0D2c->streams[1].substream_opened) || |
| 3588 | + (pcmC0D0c->streams[1].substream_opened && pcmC0D3c->streams[1].substream_opened) || |
| 3589 | + (pcmC0D1c->streams[1].substream_opened && pcmC0D2c->streams[1].substream_opened) || |
| 3590 | + (pcmC0D1c->streams[1].substream_opened && pcmC0D3c->streams[1].substream_opened) || |
| 3591 | + (pcmC0D2c->streams[1].substream_opened && pcmC0D3c->streams[1].substream_opened)) |
| 3592 | + { |
| 3593 | + print_audio("Alsa Entered func %s error busy, pcmC0D0c.opened=%d, pcmC0D1c.opened=%d, pcmC0D2c.opened=%d,pcmC0D3c.opened=%d\n", |
| 3594 | + __func__, pcmC0D0c->streams[1].substream_opened, pcmC0D1c->streams[1].substream_opened, |
| 3595 | + pcmC0D2c->streams[1].substream_opened, pcmC0D3c->streams[1].substream_opened); |
| 3596 | + sc_debug_info_record(MODULE_ID_CAP_AUDIO, "Alsa %s err, opened value pcmC0D0c=%d, pcmC0D1c=%d, pcmC0D2c=%d, pcmC0D3c=%d\n", |
| 3597 | + __func__, pcmC0D0c->streams[1].substream_opened, pcmC0D1c->streams[1].substream_opened, |
| 3598 | + pcmC0D2c->streams[1].substream_opened, pcmC0D3c->streams[1].substream_opened); |
| 3599 | + |
| 3600 | + return -EBUSY; |
| 3601 | + //BUG(); |
| 3602 | + } |
| 3603 | + |
| 3604 | #if 0 |
| 3605 | - unsigned long flags; |
| 3606 | - if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { |
| 3607 | - gpio_set_value(ZX29_GPIO_125, GPIO_LOW); |
| 3608 | - mdelay(1); |
| 3609 | - |
| 3610 | - raw_spin_lock_irqsave(&codec_pa_lock, flags); |
| 3611 | - gpio_set_value(ZX29_GPIO_125, GPIO_HIGH); |
| 3612 | - udelay(2); |
| 3613 | - gpio_set_value(ZX29_GPIO_125, GPIO_LOW); |
| 3614 | - udelay(2); |
| 3615 | - gpio_set_value(ZX29_GPIO_125, GPIO_HIGH); |
| 3616 | - udelay(2); |
| 3617 | - gpio_set_value(ZX29_GPIO_125, GPIO_LOW); |
| 3618 | - udelay(2); |
| 3619 | - gpio_set_value(ZX29_GPIO_125, GPIO_HIGH); |
| 3620 | - raw_spin_unlock_irqrestore(&codec_pa_lock, flags); |
| 3621 | - } |
| 3622 | + unsigned long flags; |
| 3623 | + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { |
| 3624 | + gpio_set_value(ZX29_GPIO_125, GPIO_LOW); |
| 3625 | + mdelay(1); |
| 3626 | + |
| 3627 | + raw_spin_lock_irqsave(&codec_pa_lock, flags); |
| 3628 | + gpio_set_value(ZX29_GPIO_125, GPIO_HIGH); |
| 3629 | + udelay(2); |
| 3630 | + gpio_set_value(ZX29_GPIO_125, GPIO_LOW); |
| 3631 | + udelay(2); |
| 3632 | + gpio_set_value(ZX29_GPIO_125, GPIO_HIGH); |
| 3633 | + udelay(2); |
| 3634 | + gpio_set_value(ZX29_GPIO_125, GPIO_LOW); |
| 3635 | + udelay(2); |
| 3636 | + gpio_set_value(ZX29_GPIO_125, GPIO_HIGH); |
| 3637 | + raw_spin_unlock_irqrestore(&codec_pa_lock, flags); |
| 3638 | + } |
| 3639 | #endif |
| 3640 | - |
| 3641 | - |
| 3642 | - return 0; |
| 3643 | - } |
| 3644 | + |
| 3645 | + |
| 3646 | + return 0; |
| 3647 | +} |
| 3648 | +/* Ended by AICoder, pid:we8d34d80fbc7981449d0b1590d6b753b789d779 */ |
| 3649 | |
| 3650 | static void zx29_shutdown(struct snd_pcm_substream *substream) |
| 3651 | { |
| 3652 | diff --git a/upstream/linux-5.10/sound/soc/sanechips/zx29_ti3100.c b/upstream/linux-5.10/sound/soc/sanechips/zx29_ti3100.c |
| 3653 | index 9959350..3b9bedf 100755 |
| 3654 | --- a/upstream/linux-5.10/sound/soc/sanechips/zx29_ti3100.c |
| 3655 | +++ b/upstream/linux-5.10/sound/soc/sanechips/zx29_ti3100.c |
| 3656 | @@ -37,6 +37,7 @@ |
| 3657 | |
| 3658 | |
| 3659 | #include "i2s.h" |
| 3660 | +#include "pub_debug_info.h" |
| 3661 | |
| 3662 | #define ZX29_I2S_TOP_LOOP_REG 0x60 |
| 3663 | |
| 3664 | @@ -370,48 +371,97 @@ |
| 3665 | |
| 3666 | |
| 3667 | |
| 3668 | - static int zx29startup(struct snd_pcm_substream *substream) |
| 3669 | - { |
| 3670 | - // int ret = 0; |
| 3671 | - print_audio("Alsa Entered func %s\n", __func__); |
| 3672 | - //CPPS_FUNC(cpps_callbacks, zDrv_Audio_Printf)("Alsa: zx29_startup device=%d,stream=%d\n", substream->pcm->device, substream->stream); |
| 3673 | +/* Started by AICoder, pid:cd752b8f85qb5fa14ec60aceb0c11d619783bee6 */ |
| 3674 | +static int zx29startup(struct snd_pcm_substream *substream) |
| 3675 | +{ |
| 3676 | + //int ret = 0; |
| 3677 | + print_audio("Alsa Entered func %s\n", __func__); |
| 3678 | + //CPPS_FUNC(cpps_callbacks, zDrv_Audio_Printf)("Alsa: zx29_startup device=%d,stream=%d\n", substream->pcm->device, substream->stream); |
| 3679 | + |
| 3680 | + struct snd_pcm *pcmC0D0p = snd_lookup_minor_data(16, SNDRV_DEVICE_TYPE_PCM_PLAYBACK); |
| 3681 | + struct snd_pcm *pcmC0D1p = snd_lookup_minor_data(17, SNDRV_DEVICE_TYPE_PCM_PLAYBACK); |
| 3682 | + struct snd_pcm *pcmC0D2p = snd_lookup_minor_data(18, SNDRV_DEVICE_TYPE_PCM_PLAYBACK); |
| 3683 | + struct snd_pcm *pcmC0D3p = snd_lookup_minor_data(19, SNDRV_DEVICE_TYPE_PCM_PLAYBACK); |
| 3684 | + //struct snd_pcm *pcmC0D4p = snd_lookup_minor_data(20, SNDRV_DEVICE_TYPE_PCM_PLAYBACK); |
| 3685 | |
| 3686 | - struct snd_pcm *pcmC0D0p = snd_lookup_minor_data(16, SNDRV_DEVICE_TYPE_PCM_PLAYBACK); |
| 3687 | - struct snd_pcm *pcmC0D1p = snd_lookup_minor_data(17, SNDRV_DEVICE_TYPE_PCM_PLAYBACK); |
| 3688 | - struct snd_pcm *pcmC0D2p = snd_lookup_minor_data(18, SNDRV_DEVICE_TYPE_PCM_PLAYBACK); |
| 3689 | - struct snd_pcm *pcmC0D3p = snd_lookup_minor_data(19, SNDRV_DEVICE_TYPE_PCM_PLAYBACK); |
| 3690 | - if ((pcmC0D0p == NULL) || (pcmC0D1p == NULL) || (pcmC0D2p == NULL) || (pcmC0D3p == NULL)) |
| 3691 | - return -EINVAL; |
| 3692 | - if ((pcmC0D0p->streams[0].substream_opened && pcmC0D1p->streams[0].substream_opened) || |
| 3693 | - (pcmC0D0p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) || |
| 3694 | - (pcmC0D0p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) || |
| 3695 | - (pcmC0D1p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) || |
| 3696 | - (pcmC0D1p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) || |
| 3697 | - (pcmC0D2p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened)) |
| 3698 | - BUG(); |
| 3699 | + struct snd_pcm *pcmC0D0c = snd_lookup_minor_data(24, SNDRV_DEVICE_TYPE_PCM_CAPTURE); |
| 3700 | + struct snd_pcm *pcmC0D1c = snd_lookup_minor_data(25, SNDRV_DEVICE_TYPE_PCM_CAPTURE); |
| 3701 | + struct snd_pcm *pcmC0D2c = snd_lookup_minor_data(26, SNDRV_DEVICE_TYPE_PCM_CAPTURE); |
| 3702 | + struct snd_pcm *pcmC0D3c = snd_lookup_minor_data(27, SNDRV_DEVICE_TYPE_PCM_CAPTURE); |
| 3703 | + //struct snd_pcm *pcmC0D4c = snd_lookup_minor_data(28, SNDRV_DEVICE_TYPE_PCM_CAPTURE); |
| 3704 | + |
| 3705 | + if ((pcmC0D0p == NULL) || (pcmC0D1p == NULL) || (pcmC0D2p == NULL) || (pcmC0D3p == NULL)) |
| 3706 | + { |
| 3707 | + print_audio("Alsa Entered func %s, pcmC0D0p=%p, pcmC0D1p=%p, pcmC0D2p=%p, pcmC0D3p=%p\n", __func__, |
| 3708 | + pcmC0D0p, pcmC0D1p, pcmC0D2p, pcmC0D3p); |
| 3709 | + return -EINVAL; |
| 3710 | + } |
| 3711 | + if ((pcmC0D0p->streams[0].substream_opened && pcmC0D1p->streams[0].substream_opened) || |
| 3712 | + (pcmC0D0p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) || |
| 3713 | + (pcmC0D0p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) || |
| 3714 | + (pcmC0D1p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) || |
| 3715 | + (pcmC0D1p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) || |
| 3716 | + (pcmC0D2p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened)) |
| 3717 | + { |
| 3718 | + print_audio("Alsa Entered func %s error busy, pcmC0D0p.opened=%d, pcmC0D1p.opened=%d, pcmC0D2p.opened=%d, pcmC0D3p.opened=%d\n", |
| 3719 | + __func__, pcmC0D0p->streams[0].substream_opened, pcmC0D1p->streams[0].substream_opened, |
| 3720 | + pcmC0D2p->streams[0].substream_opened, pcmC0D3p->streams[0].substream_opened); |
| 3721 | + sc_debug_info_record(MODULE_ID_CAP_AUDIO, "Alsa %s err, opened value pcmC0D0p=%d, pcmC0D1p=%d, pcmC0D2p=%d, pcmC0D3p=%d\n", |
| 3722 | + __func__, pcmC0D0p->streams[0].substream_opened, pcmC0D1p->streams[0].substream_opened, |
| 3723 | + pcmC0D2p->streams[0].substream_opened, pcmC0D3p->streams[0].substream_opened); |
| 3724 | + |
| 3725 | + return -EBUSY; |
| 3726 | + //BUG(); |
| 3727 | + } |
| 3728 | + |
| 3729 | + if ((pcmC0D0c == NULL) || (pcmC0D1c == NULL) || (pcmC0D2c == NULL) || (pcmC0D3c == NULL)) |
| 3730 | + { |
| 3731 | + print_audio("Alsa Entered func %s, pcmC0D0c=%p, pcmC0D1c=%p, pcmC0D2c=%p, pcmC0D3c=%p\n", __func__, |
| 3732 | + pcmC0D0c, pcmC0D1c, pcmC0D2c, pcmC0D3c); |
| 3733 | + return -EINVAL; |
| 3734 | + } |
| 3735 | + if ((pcmC0D0c->streams[1].substream_opened && pcmC0D1c->streams[1].substream_opened) || |
| 3736 | + (pcmC0D0c->streams[1].substream_opened && pcmC0D2c->streams[1].substream_opened) || |
| 3737 | + (pcmC0D0c->streams[1].substream_opened && pcmC0D3c->streams[1].substream_opened) || |
| 3738 | + (pcmC0D1c->streams[1].substream_opened && pcmC0D2c->streams[1].substream_opened) || |
| 3739 | + (pcmC0D1c->streams[1].substream_opened && pcmC0D3c->streams[1].substream_opened) || |
| 3740 | + (pcmC0D2c->streams[1].substream_opened && pcmC0D3c->streams[1].substream_opened)) |
| 3741 | + { |
| 3742 | + print_audio("Alsa Entered func %s error busy, pcmC0D0c.opened=%d, pcmC0D1c.opened=%d, pcmC0D2c.opened=%d,pcmC0D3c.opened=%d\n", |
| 3743 | + __func__, pcmC0D0c->streams[1].substream_opened, pcmC0D1c->streams[1].substream_opened, |
| 3744 | + pcmC0D2c->streams[1].substream_opened, pcmC0D3c->streams[1].substream_opened); |
| 3745 | + sc_debug_info_record(MODULE_ID_CAP_AUDIO, "Alsa %s err, opened value pcmC0D0c=%d, pcmC0D1c=%d, pcmC0D2c=%d, pcmC0D3c=%d\n", |
| 3746 | + __func__, pcmC0D0c->streams[1].substream_opened, pcmC0D1c->streams[1].substream_opened, |
| 3747 | + pcmC0D2c->streams[1].substream_opened, pcmC0D3c->streams[1].substream_opened); |
| 3748 | + |
| 3749 | + return -EBUSY; |
| 3750 | + //BUG(); |
| 3751 | + } |
| 3752 | + |
| 3753 | #if 0 |
| 3754 | - unsigned long flags; |
| 3755 | - if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { |
| 3756 | - gpio_set_value(ZX29_GPIO_125, GPIO_LOW); |
| 3757 | - mdelay(1); |
| 3758 | - |
| 3759 | - raw_spin_lock_irqsave(&codec_pa_lock, flags); |
| 3760 | - gpio_set_value(ZX29_GPIO_125, GPIO_HIGH); |
| 3761 | - udelay(2); |
| 3762 | - gpio_set_value(ZX29_GPIO_125, GPIO_LOW); |
| 3763 | - udelay(2); |
| 3764 | - gpio_set_value(ZX29_GPIO_125, GPIO_HIGH); |
| 3765 | - udelay(2); |
| 3766 | - gpio_set_value(ZX29_GPIO_125, GPIO_LOW); |
| 3767 | - udelay(2); |
| 3768 | - gpio_set_value(ZX29_GPIO_125, GPIO_HIGH); |
| 3769 | - raw_spin_unlock_irqrestore(&codec_pa_lock, flags); |
| 3770 | - } |
| 3771 | + unsigned long flags; |
| 3772 | + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { |
| 3773 | + gpio_set_value(ZX29_GPIO_125, GPIO_LOW); |
| 3774 | + mdelay(1); |
| 3775 | + |
| 3776 | + raw_spin_lock_irqsave(&codec_pa_lock, flags); |
| 3777 | + gpio_set_value(ZX29_GPIO_125, GPIO_HIGH); |
| 3778 | + udelay(2); |
| 3779 | + gpio_set_value(ZX29_GPIO_125, GPIO_LOW); |
| 3780 | + udelay(2); |
| 3781 | + gpio_set_value(ZX29_GPIO_125, GPIO_HIGH); |
| 3782 | + udelay(2); |
| 3783 | + gpio_set_value(ZX29_GPIO_125, GPIO_LOW); |
| 3784 | + udelay(2); |
| 3785 | + gpio_set_value(ZX29_GPIO_125, GPIO_HIGH); |
| 3786 | + raw_spin_unlock_irqrestore(&codec_pa_lock, flags); |
| 3787 | + } |
| 3788 | #endif |
| 3789 | - |
| 3790 | - |
| 3791 | - return 0; |
| 3792 | - } |
| 3793 | + |
| 3794 | + |
| 3795 | + return 0; |
| 3796 | +} |
| 3797 | +/* Ended by AICoder, pid:cd752b8f85qb5fa14ec60aceb0c11d619783bee6 */ |
| 3798 | |
| 3799 | static void zx29_shutdown(struct snd_pcm_substream *substream) |
| 3800 | { |
| 3801 | diff --git a/upstream/pub/include/infra/pub_debug_info.h b/upstream/pub/include/infra/pub_debug_info.h |
| 3802 | index 95a480f..1ee2f88 100755 |
| 3803 | --- a/upstream/pub/include/infra/pub_debug_info.h |
| 3804 | +++ b/upstream/pub/include/infra/pub_debug_info.h |
| 3805 | @@ -36,6 +36,10 @@ |
| 3806 | |
| 3807 | #define MODULE_ID_CAP_FOTA ("cap_fota") |
| 3808 | #define MODULE_ID_CAP_FS_CHECK ("cap_fs_check") |
| 3809 | + |
| 3810 | +#define MODULE_ID_PS_AUDIO ("ps_audio") |
| 3811 | +#define MODULE_ID_AP_AUDIO ("ap_audio") |
| 3812 | +#define MODULE_ID_CAP_AUDIO ("cap_audio") |
| 3813 | |
| 3814 | #if defined(_USE_ZXIC_DEBUG_INFO) |
| 3815 | int sc_debug_info_vrecord(char *id, const char *format, va_list args); |
| 3816 | diff --git a/upstream/pub/include/ps_phy/atipsevent.h b/upstream/pub/include/ps_phy/atipsevent.h |
| 3817 | index 92e71e6..adc2b63 100755 |
| 3818 | --- a/upstream/pub/include/ps_phy/atipsevent.h |
| 3819 | +++ b/upstream/pub/include/ps_phy/atipsevent.h |
| 3820 | @@ -952,6 +952,7 @@ |
| 3821 | #define MMIA_UMM_FAST_FREQ_SCAN_REQ_EV (DWORD)(MMIA_UMM_EVENT_BASE + 35)
|
| 3822 | #define MMIA_UMM_IMSAIRREL_REQ_EV (DWORD)(MMIA_UMM_EVENT_BASE + 36)
|
| 3823 | #define MMIA_UMM_SOFTPOWER_STATUS_IND_EV (DWORD)(MMIA_UMM_EVENT_BASE + 37)
|
| 3824 | +#define MMIA_UMM_IMS_CALL_REQ_EV (DWORD)(MMIA_UMM_EVENT_BASE + 38)
|
| 3825 |
|
| 3826 |
|
| 3827 | #define MMIA_UMM_PLMN_INFO_IND_EV (DWORD)(MMIA_UMM_RSP_EVENT + 0)
|
| 3828 | @@ -1012,6 +1013,7 @@ |
| 3829 | #define MMIA_CC_T9TIMER_QRY_REQ_EV (DWORD)(MMIA_CC_EVENT_BASE + 18)
|
| 3830 | #define MMIA_CC_VOICEMODE_QRY_REQ_EV (DWORD)(MMIA_CC_EVENT_BASE + 19)
|
| 3831 | #define MMIA_CC_RESETIVS_REQ_EV (DWORD)(MMIA_CC_EVENT_BASE + 20)
|
| 3832 | +#define MMIA_CC_WAITMSD_QRY_REQ_EV (DWORD)(MMIA_CC_EVENT_BASE + 21)
|
| 3833 |
|
| 3834 | #define MMIA_CC_MOC_CNF_EV (DWORD)(MMIA_CC_RSP_EVENT + 0)
|
| 3835 | #define MMIA_CC_MTC_IND_EV (DWORD)(MMIA_CC_RSP_EVENT + 1)
|
| 3836 | @@ -1048,6 +1050,7 @@ |
| 3837 | #define MMIA_CC_CALLBACK_EVENT_EV (DWORD)(MMIA_CC_RSP_EVENT + 32)
|
| 3838 | #define MMIA_CC_VOICEMODE_QRY_CNF_EV (DWORD)(MMIA_CC_RSP_EVENT + 33)
|
| 3839 | #define MMIA_CC_RESETIVS_CNF_EV (DWORD)(MMIA_CC_RSP_EVENT + 34)
|
| 3840 | +#define MMIA_CC_WAITMSD_QRY_CNF_EV (DWORD)(MMIA_CC_RSP_EVENT + 35)
|
| 3841 |
|
| 3842 | /* ========================================================================
|
| 3843 | MMIA£SMSÏûÏ¢ºÅ¶¨Òå
|
| 3844 | diff --git a/upstream/pub/include/ps_phy/psevent.h b/upstream/pub/include/ps_phy/psevent.h |
| 3845 | index d1fbdf8..4a1897b 100755 |
| 3846 | --- a/upstream/pub/include/ps_phy/psevent.h |
| 3847 | +++ b/upstream/pub/include/ps_phy/psevent.h |
| 3848 | @@ -1588,6 +1588,7 @@ |
| 3849 | #define IVS_CC_MSD_STATE_IND_EV (DWORD)(CM_MM_EVENT_BASE + 25)
|
| 3850 |
|
| 3851 | #define PSAP_UL_PCM_IND_EV (DWORD)(CM_MM_EVENT_BASE + 26)
|
| 3852 | +#define CC_UMM_ECALL_EVENT_IND_EV (DWORD)(CM_MM_EVENT_BASE + 27)
|
| 3853 |
|
| 3854 | /* ========================================================================
|
| 3855 | UMM£MM/GMM/EMMÏûÏ¢ºÅ¶¨Òå
|
| 3856 | @@ -4000,6 +4001,7 @@ |
| 3857 | /*ESM->UMM*/
|
| 3858 | #define ESM_UMM_DETACH_REQ_EV (DWORD)(ESM_UMM_EVENT_BASE + 0) /*Modified:KangShuJie*/
|
| 3859 | #define ESM_UMM_LOCAL_DEACT_IND_EV (DWORD)(ESM_UMM_EVENT_BASE + 1)
|
| 3860 | +#define ESM_UMM_EMERPDN_DEACT_IND_EV (DWORD)(ESM_UMM_EVENT_BASE + 2)
|
| 3861 |
|
| 3862 | /* ========================================================================
|
| 3863 | SMºÍESMÄ£¿é¼äÏûÏ¢ºÅ¶¨Òå
|