Merge "[Feature]add the compilation macros to control syslog enctyption"
diff --git a/ap/os/linux/linux-3.4.x/drivers/net/wireless/aic8800d80l/aicwf_sdio.c b/ap/os/linux/linux-3.4.x/drivers/net/wireless/aic8800d80l/aicwf_sdio.c
index 177bb92..95c40dc 100755
--- a/ap/os/linux/linux-3.4.x/drivers/net/wireless/aic8800d80l/aicwf_sdio.c
+++ b/ap/os/linux/linux-3.4.x/drivers/net/wireless/aic8800d80l/aicwf_sdio.c
@@ -2062,7 +2062,7 @@
struct mmc_host *host;
u8 byte_mode_disable = 0x1;//1: no byte mode
int ret = 0;
- uint32_t sdio_clock = 100000000;
+ uint32_t sdio_clock = 78000000; //zw.wang WiFi low temperature -40 degrees failure on 20240716
u8 val;
u8 val1 = 0;
//struct aicbsp_feature_t feature;
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-wifi-demo/files/lynq-wifi-demo.cpp b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-wifi-demo/files/lynq-wifi-demo.cpp
index c116e65..949c1f3 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-wifi-demo/files/lynq-wifi-demo.cpp
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-wifi-demo/files/lynq-wifi-demo.cpp
@@ -13,6 +13,7 @@
#include <syslog.h>
#include <pthread.h>
+#include <include/lynq-qser-autosuspend.h>
#include <include/lynq-qser-wifi.h>
void lynq_wifi_event_handle_demo(lynq_wifi_event_s *event, void *arg)
@@ -51,6 +52,12 @@
int main(int argc, char *argv[])
{
+ int num = qser_wakelock_create("wifi_lock", 10);
+ if(num < 0)
+ {
+ printf("wakelock create fail\n");
+ printf("num=%d\n", num);
+ }
lynq_wifi_ap_index_e type;
if (strcmp(argv[0], "lynq-wifi-demo") == 0)
type = LYNQ_WIFI_AP_INDEX_AP0; // 2.4G
@@ -63,6 +70,18 @@
qser_wifi_enable(); // enable wifi
qser_wifi_ap_stop(type); // Disable ap mode for 2.4G/5G
qser_wifi_disable(); // Turn off WiFi
+ int ret = qser_wakelock_unlock(num);
+ if(ret != 0)
+ {
+ printf("wakelock unlock fail\n");
+ printf("ret=%d\n", ret);
+ }
+ ret = qser_wakelock_destroy(num);
+ if(ret != 0)
+ {
+ printf("wakelock destroy fail\n");
+ printf("ret=%d\n", ret);
+ }
}
else if (strcmp(argv[1], "1") == 0) //Load WiFi and turn on WiFi
{
@@ -93,6 +112,12 @@
}
qser_wifi_ap_auth_set(type, LYNQ_WIFI_AUTH_WPA2_PSK, pw); // Set the authentication of 2.4G/5G to wpa2 and the password to lynq123456
qser_wifi_ap_start(type); // Set the ap mode of 2.4G/5G
+ int ret = qser_wakelock_lock(num);
+ if(ret != 0)
+ {
+ printf("wakelock lock fail\n");
+ printf("ret=%d\n", ret);
+ }
}
else if (strcmp(argv[1], "2") == 0) //Callback query that only covers WiFi as an ap
{
@@ -195,7 +220,12 @@
qser_wifi_sta_start();
qser_wifi_sta_start_scan(); // When this function is executed once, sta's scan is called once
memset(cmdstr, 0, sizeof(cmdstr));
-
+ ret = qser_wakelock_lock(num);
+ if(ret != 0)
+ {
+ printf("wakelock lock fail\n");
+ printf("ret=%d\n", ret);
+ }
while (1)
{
printf("[lynq-wifi-demo]Enter the ssid and password as shown in the following example:ssid auth paris pw ||sta_pkt_get ||sta_param_get || sta_scan ||sta_stop\n");
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-wifi-demo/files/makefile b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-wifi-demo/files/makefile
index bac0c42..e3ec151 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-wifi-demo/files/makefile
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-wifi-demo/files/makefile
@@ -29,6 +29,7 @@
-lstdc++ \
-lpthread \
-llynq-qser-wifi \
+ -llynq-qser-autosuspend \
SOURCES = lynq-wifi-demo.cpp
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-wifi-demo/lynq-wifi-demo.bb b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-wifi-demo/lynq-wifi-demo.bb
index 2b48617..ffd0288 100644
--- a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-wifi-demo/lynq-wifi-demo.bb
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-wifi-demo/lynq-wifi-demo.bb
@@ -8,6 +8,7 @@
file://makefile \
"
DEPENDS += "liblynq-qser-wifi"
+DEPENDS += "liblynq-qser-autosuspend"
SRC-DIR = "${S}/../lynq-wifi-demo"
FILES_${PN} += "${bindir}/"
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-data/lynq-qser-data.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-qser-data/lynq-qser-data.cpp
index 995b7e4..421383b 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-qser-data/lynq-qser-data.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-data/lynq-qser-data.cpp
@@ -17,6 +17,8 @@
#define APN_DB_READED 0
#define APN_DB_ERR 1
#define APN_DB_CREATE 2
+#define APN_TABLE_CREATE 3
+#define APN_TABLE_NEED_CREATE 4
#define RESULT_OK (0)
#define RESULT_ERROR (-1)
@@ -721,9 +723,69 @@
pthread_mutex_unlock(&s_qser_data_database_mutex);
return 0;
}
+check_apn_table_cb(void *data, int argc, char **argv, char **azColName)
+{
+ if(data==NULL)
+ {
+ return 1;
+ }
+ int *temp = (int *)data;
+ for(int i=0; i<argc; i++){
+ LYINFLOG("[%s]%s = %s", __FUNCTION__,azColName[i], argv[i] ? argv[i] : "NULL");
+ }
+ *temp = atoi(argv[0]);
+ LYINFLOG("\nThe number is %d\n", *temp);
+ return 0;
+}
+int check_apn_table(char*path)
+{
+ char *zErrMsg = 0;
+ int rc;
+ char *sql;
+ int num = -1;
+
+ /* Open database */
+ pthread_mutex_lock(&s_qser_data_database_mutex);
+ rc = sqlite3_open(path, &apnDb);
+ if( rc )
+ {
+ LYERRLOG("[%s] Can't open database: %s\n", __FUNCTION__,sqlite3_errmsg(apnDb));
+ pthread_mutex_unlock(&s_qser_data_database_mutex);
+ return 1;
+ }
+ LYINFLOG("[%s] Opened database successfully\n",__FUNCTION__);
+ /* Create SQL statement */
+ sql = "SELECT COUNT(*) FROM sqlite_master where type ='table' and name = 'LYNQAPN'";
+ /* Execute SQL statement */
+ rc = sqlite3_exec(apnDb, sql, check_apn_table_cb, &num, &zErrMsg);
+ if( rc != SQLITE_OK )
+ {
+ LYERRLOG("SQL error: %s\n", zErrMsg);
+ sqlite3_free(zErrMsg);
+ sqlite3_close(apnDb);
+ pthread_mutex_unlock(&s_qser_data_database_mutex);
+ return 1;
+ }
+ LYINFLOG("Table LYNQAPN check successfully\n");
+ sqlite3_close(apnDb);
+ pthread_mutex_unlock(&s_qser_data_database_mutex);
+ if(num <= 0)
+ {
+ LYINFLOG("No table LYNQAPN, num = %d\n", num);
+ return APN_TABLE_NEED_CREATE;
+ }
+ else
+ {
+ LYINFLOG("The table LYNQAPN exist, num = %d\n", num);
+ return APN_TABLE_CREATE;
+ }
+
+ return 0;
+}
static int init_apn_db()
{
int db_ret=0;
+ int check_ret=0;
int table_ret=0;
pthread_mutex_init(&s_qser_data_database_mutex, NULL);
@@ -741,7 +803,26 @@
}
else if(db_ret==APN_DB_READED)
{
- LYERRLOG("[%s] apn db has be build!!!",__FUNCTION__);
+ LYINFLOG("[%s] apn db has be build!!!",__FUNCTION__);
+ check_ret = check_apn_table(APN_DB_PATH);
+ if(check_ret == APN_TABLE_NEED_CREATE)
+ {
+ table_ret = create_apn_table(APN_DB_PATH);
+ if(table_ret!=0)
+ {
+ LYERRLOG("create apn table fail!!!");
+ return 1;
+ }
+ apn_db_add(0, &default_apn);
+ }
+ else if(check_ret == APN_TABLE_CREATE)
+ {
+ LYINFLOG("Table LYNQAPN has created");
+ }
+ else
+ {
+ LYERRLOG("check table fail!!!, ret = %d", check_ret);
+ }
}
else
{
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-fota/lynq-qser-fota.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-qser-fota/lynq-qser-fota.cpp
index 1589c5f..811e7e7 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-qser-fota/lynq-qser-fota.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-fota/lynq-qser-fota.cpp
@@ -123,7 +123,7 @@
int lynq_get_upgrade_type();
int lynq_get_sync_status();
int lynq_set_sync_status(char *option_para);
-
+int calculate_md5_sum( char *md5_sum,int md5_size);
/*****************************************
* @brief:rock_update_main
@@ -145,6 +145,7 @@
time_t endTime;
struct tm *localTime;
double elapsed = 0;
+ char md5_sum[48] = {0};
FILE *fp = NULL;
fp = fopen(FOTA_FLAG_FILE,"w+");
@@ -192,6 +193,12 @@
return -1;
}
+ ret = calculate_md5_sum(md5_sum,sizeof(md5_sum));
+ if(ret != 0)
+ {
+ LYINFLOG("Calculate md5 sum failed");
+ }
+
startTime = time(NULL);
if(startTime == (time_t)-1)
{
@@ -211,7 +218,7 @@
if(ret != 0)
{
LYERRLOG("Upgrade failed");
- ret = sc_debug_info_record(MODULE_ID_CAP_FOTA,"failed,spendtime: %.2lf seconds,package size:%d,finished time %s", elapsed,total_size,asctime(localTime));
+ ret = sc_debug_info_record(MODULE_ID_CAP_FOTA,"failed,spendtime: %.2lf seconds,finished time %s,md5:%s", elapsed,asctime(localTime),md5_sum);
if(ret <= 0)
{
LYERRLOG("lynq_record_debug_info failed");
@@ -221,7 +228,7 @@
else
{
LYINFLOG("Upgrade success");
- ret = sc_debug_info_record(MODULE_ID_CAP_FOTA,"success,spendtime: %.2lf seconds,package size:%d,finished time %s", elapsed,total_size,asctime(localTime));
+ ret = sc_debug_info_record(MODULE_ID_CAP_FOTA,"success,spendtime: %.2lf seconds,finished time %s,md5:%s", elapsed,asctime(localTime),md5_sum);
if(ret <= 0)
{
LYERRLOG("lynq_record_debug_info failed");
@@ -1006,6 +1013,58 @@
return ration;
}
+int calculate_md5_sum( char *md5_sum,int md5_size)
+{
+ FILE *fp = NULL;
+ char package_path[256] = {0};
+ char command[64] = {0};
+ char *space_pos = NULL;
+ int length = 0;
+ char command_result[64] = {0};
+
+ fp = fopen(FOTA_ADDR_FILE, "rb");
+ if(fp == NULL)
+ {
+ LYERRLOG("Open file failed", FOTA_ADDR_FILE);
+ return -1;
+ }
+ if(fgets(package_path, sizeof(package_path), fp) == NULL)
+ {
+ LYERRLOG("Read file %s failed", package_path);
+ }
+ fclose(fp);
+
+ snprintf(command, sizeof(command), "md5sum %s",package_path);
+
+ fp = popen(command, "r");
+ if (fp == NULL)
+ {
+ LYERRLOG("Failed to run command\n");
+ return -1;
+ }
+ if (fgets(command_result, sizeof(command_result), fp) != NULL)
+ {
+
+ space_pos = strchr(command_result, ' ');
+ if (space_pos != NULL)
+ {
+ length = space_pos - command_result;
+ if(length >= md5_size)
+ {
+ pclose(fp);
+ return -1;
+ }
+ strncpy(md5_sum, command_result, length);
+ md5_sum[length] = '\0';
+ }
+ }
+
+ pclose(fp);
+
+ return 0;
+
+}
+
DEFINE_LYNQ_LIB_LOG(LYNQ_FOTA)
#ifdef __cplusplus
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/spi/spi-zx29.c b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/spi/spi-zx29.c
index d570db1..3d371ea 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/spi/spi-zx29.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/spi/spi-zx29.c
@@ -158,8 +158,6 @@
#define SPI_INTR_EN_MASK_TX_EMPTY_IE (0x1UL << 3)
#define SPI_INTR_EN_MASK_RX_THRES_IE (0x1UL << 4)
#define SPI_INTR_EN_MASK_TX_THRES_IE (0x1UL << 5)
-//yu.dong@20240617 [T106BUG-641] SPI packet loss problem, add kernel buffer scheme.
-#define SPI_INTR_EN_MASK_MST_EOT_IE (0x1UL << 6)
/*
* SPI Interrupt Status Register OR Interrupt Clear Register - SPI_INTR_SR_SCLR
@@ -1984,24 +1982,25 @@
return ret;
}
+/* yu.dong@20240715 [T106BUG-641] SPI packet loss problem, merged into ZXW patch start */
/* yu.dong@20240617 [T106BUG-641] SPI packet loss problem, add kernel buffer scheme start */
-#define SPI_SLVAE_RX_BUFF_SIZE 4096
-#define SPI_SLVAE_RX_MAX_PACK_NUM 15
-#define SPI_SLVAE_RX_PACK_LEN 146
-#define SPI_SLVAE_RX_LIST_BUFF_LEN (SPI_SLVAE_RX_MAX_PACK_NUM*SPI_SLVAE_RX_PACK_LEN)
-static dma_channel_def slave_rx_conf[SPI_SLVAE_RX_MAX_PACK_NUM] = {0};
+#define SPI_SLAVE_RX_BUFF_SIZE 4096
+#define SPI_SLAVE_RX_MAX_PACK_NUM 15
+#define SPI_SLAVE_RX_PACK_LEN 146
+#define SPI_SLAVE_RX_LIST_BUFF_LEN (SPI_SLAVE_RX_MAX_PACK_NUM*SPI_SLAVE_RX_PACK_LEN)
+static dma_channel_def slave_rx_conf[SPI_SLAVE_RX_MAX_PACK_NUM] = {0};
//yu.dong@20240617 [T106BUG-641] SPI packet loss issue, increase kernel buffer and read all cached data away, no data loss.
#define SPI_MAGIC 0x55555555
static bool rxbuf_is_free_space(struct spi_device *spi)
{
if (spi->recv_pos < spi->rd_pos) {
- if ((spi->rd_pos - spi->recv_pos) > SPI_SLVAE_RX_PACK_LEN)
+ if ((spi->rd_pos - spi->recv_pos) > SPI_SLAVE_RX_PACK_LEN)
return 1;
else
return 0;
}
else {
- if ((SPI_SLVAE_RX_BUFF_SIZE - spi->recv_pos + spi->rd_pos ) > SPI_SLVAE_RX_PACK_LEN)
+ if ((SPI_SLAVE_RX_BUFF_SIZE - spi->recv_pos + spi->rd_pos ) > SPI_SLAVE_RX_PACK_LEN)
return 1;
else
return 0;
@@ -2018,26 +2017,26 @@
zx29spi = spi_master_get_devdata(spi->master);
zx29spi->spi_poll_cnt++;
- end = *(volatile unsigned int *)(spi->cyc_buf +spi->cyc_index * SPI_SLVAE_RX_PACK_LEN + SPI_SLVAE_RX_PACK_LEN - 4);
- while((end != SPI_MAGIC) && index < SPI_SLVAE_RX_MAX_PACK_NUM) {
+ end = *(volatile unsigned int *)(spi->cyc_buf +spi->cyc_index * SPI_SLAVE_RX_PACK_LEN + SPI_SLAVE_RX_PACK_LEN - 4);
+ while((end != SPI_MAGIC) && index < SPI_SLAVE_RX_MAX_PACK_NUM) {
if(!rxbuf_is_free_space(spi)) {
printk("rx_buff not enough space!!!!!");
zx29spi->spi_dma_cnt++;
break;
}else {
- if((spi->recv_pos + SPI_SLVAE_RX_PACK_LEN) <= SPI_SLVAE_RX_BUFF_SIZE) {
- memcpy(spi->rx_buf + spi->recv_pos,spi->cyc_buf + spi->cyc_index * SPI_SLVAE_RX_PACK_LEN,SPI_SLVAE_RX_PACK_LEN);
+ if((spi->recv_pos + SPI_SLAVE_RX_PACK_LEN) <= SPI_SLAVE_RX_BUFF_SIZE) {
+ memcpy(spi->rx_buf + spi->recv_pos,spi->cyc_buf + spi->cyc_index * SPI_SLAVE_RX_PACK_LEN,SPI_SLAVE_RX_PACK_LEN);
}else {
- memcpy(spi->rx_buf + spi->recv_pos,spi->cyc_buf + spi->cyc_index * SPI_SLVAE_RX_PACK_LEN,SPI_SLVAE_RX_BUFF_SIZE - spi->recv_pos);
- memcpy(spi->rx_buf,spi->cyc_buf + spi->cyc_index * SPI_SLVAE_RX_PACK_LEN + (SPI_SLVAE_RX_BUFF_SIZE - spi->recv_pos),SPI_SLVAE_RX_PACK_LEN-(SPI_SLVAE_RX_BUFF_SIZE-spi->recv_pos));
+ memcpy(spi->rx_buf + spi->recv_pos,spi->cyc_buf + spi->cyc_index * SPI_SLAVE_RX_PACK_LEN,SPI_SLAVE_RX_BUFF_SIZE - spi->recv_pos);
+ memcpy(spi->rx_buf,spi->cyc_buf + spi->cyc_index * SPI_SLAVE_RX_PACK_LEN + (SPI_SLAVE_RX_BUFF_SIZE - spi->recv_pos),SPI_SLAVE_RX_PACK_LEN-(SPI_SLAVE_RX_BUFF_SIZE-spi->recv_pos));
}
- *(volatile unsigned int *)(spi->cyc_buf +spi->cyc_index * SPI_SLVAE_RX_PACK_LEN + SPI_SLVAE_RX_PACK_LEN - 4) = SPI_MAGIC;
- spi->recv_pos = (spi->recv_pos + SPI_SLVAE_RX_PACK_LEN)%SPI_SLVAE_RX_BUFF_SIZE;
- spi->cyc_index = (spi->cyc_index + 1)%SPI_SLVAE_RX_MAX_PACK_NUM;
+ *(volatile unsigned int *)(spi->cyc_buf +spi->cyc_index * SPI_SLAVE_RX_PACK_LEN + SPI_SLAVE_RX_PACK_LEN - 4) = SPI_MAGIC;
+ spi->recv_pos = (spi->recv_pos + SPI_SLAVE_RX_PACK_LEN)%SPI_SLAVE_RX_BUFF_SIZE;
+ spi->cyc_index = (spi->cyc_index + 1)%SPI_SLAVE_RX_MAX_PACK_NUM;
zx29spi->spi_dma_cnt++;
index++;
- end = *(volatile unsigned int *)(spi->cyc_buf +spi->cyc_index * SPI_SLVAE_RX_PACK_LEN + SPI_SLVAE_RX_PACK_LEN - 4);
+ end = *(volatile unsigned int *)(spi->cyc_buf +spi->cyc_index * SPI_SLAVE_RX_PACK_LEN + SPI_SLAVE_RX_PACK_LEN - 4);
}
if(spi->is_rd_waiting == true && spi->recv_done == 0) {
@@ -2045,7 +2044,7 @@
spi->recv_done = 1;
}
}
- if((end != SPI_MAGIC) && index == SPI_SLVAE_RX_MAX_PACK_NUM)
+ if((end != SPI_MAGIC) && index == SPI_SLAVE_RX_MAX_PACK_NUM)
printk("cyc_buf be covered!!!!!");
return;
}
@@ -2056,7 +2055,7 @@
struct chip_data *chip = NULL;
struct dma_chan *rxchan = NULL;
struct dma_async_tx_descriptor *rxdesc;
- unsigned short transfer_len = SPI_SLVAE_RX_PACK_LEN;
+ unsigned short transfer_len = SPI_SLAVE_RX_PACK_LEN;
int i;
chip = zx29spi->cur_chip = spi->controller_state;
@@ -2079,7 +2078,7 @@
* not trigger on 2 elements this needs explicit mapping rather than
* calculation.
*/
- for(i = 0;i < SPI_SLVAE_RX_MAX_PACK_NUM;i++) {
+ for(i = 0;i < SPI_SLAVE_RX_MAX_PACK_NUM;i++) {
switch (zx29spi->rx_lev_trig) {
case SPI_RX_1_OR_MORE_ELEM:
slave_rx_conf[i].dma_control.src_burst_len = DMA_BURST_LEN_1;
@@ -2144,7 +2143,7 @@
/* Submit and fire RX and TX with TX last so we're ready to read! */
if (spi->rx_dma) {
- rxdesc = rxchan->device->device_prep_dma_cyclic(rxchan,NULL,SPI_SLVAE_RX_MAX_PACK_NUM * SPI_SLVAE_RX_PACK_LEN, SPI_SLVAE_RX_PACK_LEN,0,0);
+ rxdesc = rxchan->device->device_prep_dma_cyclic(rxchan,NULL,SPI_SLAVE_RX_MAX_PACK_NUM * SPI_SLAVE_RX_PACK_LEN, SPI_SLAVE_RX_PACK_LEN,0,0);
if (!rxdesc) {
printk(KERN_INFO "!!ERROR DESC !!![%s][%d]\n",__func__,__LINE__);
dmaengine_terminate_all(rxchan);
@@ -2170,14 +2169,13 @@
printk("zx29_slave_rd_start...\r\n");
zx29spi = spi_master_get_devdata(spi->master);
- dev = &zx29spi->pdev->dev;
if (!zx29spi)
return -EINVAL;
-
+ dev = &zx29spi->pdev->dev;
spi->cyc_index = 0;
spi->rd_pos = spi->recv_pos = 0;
- spi->cyc_buf = dma_alloc_coherent(dev, SPI_SLVAE_RX_BUFF_SIZE, &spi->rx_dma, GFP_KERNEL);
+ spi->cyc_buf = dma_alloc_coherent(dev, SPI_SLAVE_RX_BUFF_SIZE, &spi->rx_dma, GFP_KERNEL);
if (dma_mapping_error(dev, spi->rx_dma)) {
dev_err(dev, "dma_map_single spi rx failed\n");
return -ENOMEM;
@@ -2203,10 +2201,9 @@
struct dma_chan *rxchan = NULL;
zx29spi = spi_master_get_devdata(spi->master);
- dev = &zx29spi->pdev->dev;
if (!zx29spi)
return -EINVAL;
-
+ dev = &zx29spi->pdev->dev;
chip = zx29spi->cur_chip= spi->controller_state;
writel(chip->fifo_ctrl, (SPI_FIFO_CTRL_OFFSET+zx29spi->virtbase));
rxchan = zx29spi->dma_rx_channel;
@@ -2217,7 +2214,7 @@
}
if(spi->cyc_buf != NULL && spi->rx_dma) {
- dma_free_coherent(dev, SPI_SLVAE_RX_BUFF_SIZE, spi->cyc_buf, spi->rx_dma);
+ dma_free_coherent(dev, SPI_SLAVE_RX_BUFF_SIZE, spi->cyc_buf, spi->rx_dma);
spi->cyc_buf = NULL;
}
@@ -2230,6 +2227,7 @@
return status;
}
/* yu.dong@20240617 [T106BUG-641] SPI packet loss problem, add kernel buffer scheme end */
+/* yu.dong@20240715 [T106BUG-641] SPI packet loss problem, merged into ZXW patch end*/
static int zx29_prepare_transfer_hardware(struct spi_master *master)
{
@@ -2611,7 +2609,10 @@
ktime_t k_time_start = 0;
ktime_t k_time_end = 0;
ktime_t diff_ns = 0;
- /* yu.dong@20240617 [T106BUG-641] SPI packet loss problem, add kernel buffer scheme start */
+ /* yu.dong@20240715 [T106BUG-641] SPI packet loss problem, merged into ZXW patch start */
+ /* yu.dong@20240617 [T106BUG-641] SPI packet loss problem, add kernel buffer scheme start */
+ if(false == zx29spi->master->slave)
+ pm_stay_awake(&zx29spi->pdev->dev);
regval = readl((SPI_COM_CTRL_OFFSET+zx29spi->virtbase)) & (~SPI_COM_CTRL_MASK_SSPE);
writel(regval, (SPI_COM_CTRL_OFFSET+zx29spi->virtbase));
@@ -2635,7 +2636,10 @@
if(diff_ns >= 10000000) {
dev_info(&zx29spi->pdev->dev, " zx29_setup_to_regs failed! diff_ns=%lld \n",diff_ns);
}
-
+
+ if(false == zx29spi->master->slave)
+ pm_relax(&zx29spi->pdev->dev);
+ /* yu.dong@20240715 [T106BUG-641] SPI packet loss problem, merged into ZXW patch end */
}
/**
* zx29_setup - setup function registered to SPI master framework
@@ -2821,7 +2825,10 @@
zx29_setup_to_regs(chip,zx29spi);
}
- //yu.dong@20240617 [T106BUG-641] SPI packet loss problem, add kernel buffer scheme.
+ if(zx29spi->mode == ZX29_SSP_MASTER_TYPE) {
+ if(spi->setup_immediately == 1)
+ zx29_setup_to_regs(chip,zx29spi);
+ }
return status;
err_config_params:
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/spi/spidev.c b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/spi/spidev.c
index 1522a21..2a7cdbc 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/spi/spidev.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/spi/spidev.c
@@ -217,48 +217,30 @@
return -EMSGSIZE;
spidev = filp->private_data;
+ /* yu.dong@20240715 [T106BUG-641] SPI packet loss problem, merged into ZXW patch start */
+ if(spidev->spi->master->slave) {
+ #ifdef SPI_SLAVE_FOR_YK
+ size_t total = 0;
+ if (spidev->spi->rd_pos == spidev->spi->recv_pos) {
-
- #ifdef SPI_SLAVE_FOR_YK
- size_t total = 0;
-
- if (spidev->spi->rd_pos == spidev->spi->recv_pos) {
-
- status = 0;
- spidev->spi->is_rd_waiting = true;
- if(0 != wait_event_freezable(spidev->spi->rd_wait, spidev->spi->recv_done)) {
- if(spidev->spi->controller->spi_slave_rd_stop)
- spidev->spi->controller->spi_slave_rd_stop(spidev->spi);
- spidev->spi->is_rd_waiting = false;
- return status;
- }else {
- spidev->spi->recv_done = false;
- spidev->spi->is_rd_waiting = false;
+ status = 0;
+ spidev->spi->is_rd_waiting = true;
+ if(0 != wait_event_freezable(spidev->spi->rd_wait, spidev->spi->recv_done)) {
+ if(spidev->spi->controller->spi_slave_rd_stop)
+ spidev->spi->controller->spi_slave_rd_stop(spidev->spi);
+ spidev->spi->is_rd_waiting = false;
+ return status;
+ }else {
+ spidev->spi->recv_done = false;
+ spidev->spi->is_rd_waiting = false;
+ }
}
- }
- mutex_lock(&spidev->buf_lock);
- if(spidev->spi->rd_pos < spidev->spi->recv_pos) {
+ mutex_lock(&spidev->buf_lock);
+ if(spidev->spi->rd_pos < spidev->spi->recv_pos) {
- total = spidev->spi->recv_pos - spidev->spi->rd_pos;
- status = (total > count) ? count : total;
-
- missing = copy_to_user(buf, spidev->rx_buffer+spidev->spi->rd_pos, status);
- if (missing == status) {
- status = -EFAULT;
- }
- else {
- status = status - missing;
- spidev->spi->rd_pos += status;
- }
-
- }else if(spidev->spi->rd_pos > spidev->spi->recv_pos) {
-
- total = bufsiz - (spidev->spi->rd_pos - spidev->spi->recv_pos);
- status = (total > count) ? count : total;
-
- if((spidev->spi->rd_pos + status) <= bufsiz) {
-
+ total = spidev->spi->recv_pos - spidev->spi->rd_pos;
+ status = (total > count) ? count : total;
missing = copy_to_user(buf, spidev->rx_buffer+spidev->spi->rd_pos, status);
if (missing == status) {
status = -EFAULT;
@@ -266,48 +248,81 @@
else {
status = status - missing;
spidev->spi->rd_pos += status;
- spidev->spi->rd_pos = spidev->spi->rd_pos%bufsiz;
- }
- }else {
-
- unsigned long first,rest;
-
- first = bufsiz - spidev->spi->rd_pos;
- missing = copy_to_user(buf, spidev->rx_buffer+spidev->spi->rd_pos, first);
- if (missing == first) {
- status = -EFAULT;
- } else {
- status = status - missing;
}
- rest = status-first;
- missing = copy_to_user(buf+first, spidev->rx_buffer, rest);
- if (missing == rest) {
- status = -EFAULT;
- } else {
- status = status - missing;
+ }else if(spidev->spi->rd_pos > spidev->spi->recv_pos) {
+
+ total = bufsiz - (spidev->spi->rd_pos - spidev->spi->recv_pos);
+ status = (total > count) ? count : total;
+
+ if((spidev->spi->rd_pos + status) <= bufsiz) {
+
+ missing = copy_to_user(buf, spidev->rx_buffer+spidev->spi->rd_pos, status);
+ if (missing == status) {
+ status = -EFAULT;
+ }
+ else {
+ status = status - missing;
+ spidev->spi->rd_pos += status;
+ spidev->spi->rd_pos = spidev->spi->rd_pos%bufsiz;
+ }
+ }else {
+
+ unsigned long first,rest;
+
+ first = bufsiz - spidev->spi->rd_pos;
+ missing = copy_to_user(buf, spidev->rx_buffer+spidev->spi->rd_pos, first);
+ if (missing == first) {
+ status = -EFAULT;
+ } else {
+ status = status - missing;
+ }
+
+ rest = status-first;
+ missing = copy_to_user(buf+first, spidev->rx_buffer, rest);
+ if (missing == rest) {
+ status = -EFAULT;
+ } else {
+ status = status - missing;
+ }
+ spidev->spi->rd_pos = rest;
}
- spidev->spi->rd_pos = rest;
}
- }
- #else
- mutex_lock(&spidev->buf_lock);
- if(spidev->rd_from_rx_buffer)
- status = count;
- else
- status = spidev_sync_read(spidev, count);
-
- if (status > 0) {
-
- missing = copy_to_user(buf, spidev->rx_buffer, status);
- if (missing == status)
- status = -EFAULT;
+ #else
+ mutex_lock(&spidev->buf_lock);
+ if(spidev->rd_from_rx_buffer)
+ status = count;
else
- status = status - missing;
- }
- #endif
- mutex_unlock(&spidev->buf_lock);
+ status = spidev_sync_read(spidev, count);
+ if (status > 0) {
+
+ missing = copy_to_user(buf, spidev->rx_buffer, status);
+ if (missing == status)
+ status = -EFAULT;
+ else
+ status = status - missing;
+ }
+ #endif
+ mutex_unlock(&spidev->buf_lock);
+ }else {
+ mutex_lock(&spidev->buf_lock);
+
+ if(spidev->rd_from_rx_buffer)
+ status = count;
+ else
+ status = spidev_sync_read(spidev, count);
+
+ if(status > 0) {
+ missing = copy_to_user(buf, spidev->rx_buffer, status);
+ if (missing == status)
+ status = -EFAULT;
+ else
+ status = status - missing;
+ }
+ mutex_unlock(&spidev->buf_lock);
+ }
+ /* yu.dong@20240715 [T106BUG-641] SPI packet loss problem, merged into ZXW patch end */
return status;
}
/* yu.dong@20240617 [T106BUG-641] SPI packet loss problem, add kernel buffer scheme end*/
@@ -783,15 +798,19 @@
}
}
- /* yu.dong@20240617 [T106BUG-641] SPI packet loss problem, add kernel buffer scheme start */
- #ifdef SPI_SLAVE_FOR_YK
- if(spidev->rx_buffer) {
- spidev->spi->rx_buf = spidev->rx_buffer;
- if(spidev->spi->controller->spi_slave_rd_start)
- spidev->spi->controller->spi_slave_rd_start(spidev->spi);
- }
- #endif
- /* yu.dong@20240617 [T106BUG-641] SPI packet loss problem, add kernel buffer scheme end */
+ /* yu.dong@20240715 [T106BUG-641] SPI packet loss problem, merged into ZXW patch start */
+ /* yu.dong@20240617 [T106BUG-641] SPI packet loss problem, add kernel buffer scheme start */
+ if(spidev->spi->master->slave) {
+ #ifdef SPI_SLAVE_FOR_YK
+ if(spidev->rx_buffer) {
+ spidev->spi->rx_buf = spidev->rx_buffer;
+ if(spidev->spi->controller->spi_slave_rd_start)
+ spidev->spi->controller->spi_slave_rd_start(spidev->spi);
+ }
+ #endif
+ }
+ /* yu.dong@20240617 [T106BUG-641] SPI packet loss problem, add kernel buffer scheme end */
+ /* yu.dong@20240715 [T106BUG-641] SPI packet loss problem, merged into ZXW patch end */
spidev->users++;
filp->private_data = spidev;
stream_open(inode, filp);
@@ -838,14 +857,18 @@
spi = spi_dev_get(spidev->spi);
spin_unlock_irq(&spidev->spi_lock);
- /* yu.dong@20240617 [T106BUG-641] SPI packet loss problem, add kernel buffer scheme start */
- #ifdef SPI_SLAVE_FOR_YK
- if(spidev->rx_buffer) {
- if(spi->controller->spi_slave_rd_stop)
- spi->controller->spi_slave_rd_stop(spi);
- }
- #endif
- /* yu.dong@20240617 [T106BUG-641] SPI packet loss problem, add kernel buffer scheme end */
+ /* yu.dong@20240715 [T106BUG-641] SPI packet loss problem, merged into ZXW patch start */
+ /* yu.dong@20240617 [T106BUG-641] SPI packet loss problem, add kernel buffer scheme start */
+ if(spidev->spi->master->slave) {
+ #ifdef SPI_SLAVE_FOR_YK
+ if(spidev->rx_buffer) {
+ if(spi->controller->spi_slave_rd_stop)
+ spi->controller->spi_slave_rd_stop(spi);
+ }
+ #endif
+ }
+ /* yu.dong@20240617 [T106BUG-641] SPI packet loss problem, add kernel buffer scheme end */
+ /* yu.dong@20240715 [T106BUG-641] SPI packet loss problem, merged into ZXW patch end*/
if(spi && spi->master->slave)
pm_relax(&spi->dev);
kfree(spidev->tx_buffer);
@@ -2257,7 +2280,14 @@
dev_info(&spi->dev,"trans_gap_num = 0x%x",val);
}
- // yu.dong@20240617 [T106BUG-641] SPI packet loss problem, add kernel buffer scheme.
+ if (device_property_read_u32(&spi->dev, "setup-immediately",&val)) {
+ spi->setup_immediately = 0;
+ dev_err(&spi->dev,"setup-immediately get failed");
+ }
+ else {
+ spi->setup_immediately = val;
+ dev_info(&spi->dev,"setup-immediately = 0x%x",val);
+ }
/* If we can allocate a minor number, hook up this device.
* Reusing minors is fine so long as udev or mdev is working.
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/include/linux/spi/spi.h b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/include/linux/spi/spi.h
index 569ba92..6135a82 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/include/linux/spi/spi.h
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/include/linux/spi/spi.h
@@ -210,7 +210,8 @@
u8 trans_gaped;
u8 trans_gap_num;
/* yu.dong@20240617 [T106BUG-641] SPI packet loss problem, add kernel buffer scheme start */
- u32 rd_pos;
+ u8 setup_immediately;
+ u32 rd_pos;
u32 recv_pos;
u8 * rx_buf;
u8 * cyc_buf;
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libtinyalsa/audio_mixer_ctrl.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libtinyalsa/audio_mixer_ctrl.c
index 0ff24e3..c6ae463 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libtinyalsa/audio_mixer_ctrl.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libtinyalsa/audio_mixer_ctrl.c
@@ -788,19 +788,69 @@
/* yu.dong@20240627 [T106BUG-615]CODEC 8311 using voice_demo to set codec volume has no effect start */
-/*
-static int output_vol_conversion(int vol)
-{
- return 255;
-
-}
-*/
+/* yu.dong@20240716 [T106BUG-615]Abnormal whistling tone heard on the side of the phone when dialing in 3G network start */
+enum t_input_vol {
+ T_INPUT_VOL_MINUS_96DB = 0,
+ T_INPUT_VOL_MINUS_95DB = 2,
+ T_INPUT_VOL_MINUS_90DB = 12,
+ T_INPUT_VOL_MINUS_85DB = 22,
+ T_INPUT_VOL_MINUS_80DB = 32,
+ T_INPUT_VOL_MINUS_75DB = 42,
+ T_INPUT_VOL_MINUS_70DB = 52,
+ T_INPUT_VOL_MINUS_65DB = 62,
+ T_INPUT_VOL_MINUS_60DB = 72,
+ T_INPUT_VOL_MINUS_55DB = 82,
+ T_INPUT_VOL_MINUS_50DB = 92,
+ T_INPUT_VOL_MINUS_45DB = 102,
+ T_INPUT_VOL_MINUS_40DB = 112,
+ T_INPUT_VOL_MINUS_35DB = 122,
+ T_INPUT_VOL_MINUS_30DB = 132,
+ T_INPUT_VOL_MINUS_25DB = 142,
+ T_INPUT_VOL_MINUS_20DB = 152,
+ T_INPUT_VOL_MINUS_15DB = 162,
+ T_INPUT_VOL_MINUS_10DB = 172,
+ T_INPUT_VOL_MINUS_7DB = 178,
+ T_INPUT_VOL_MINUS_6DB = 180,
+ T_INPUT_VOL_MINUS_5DB = 182,
+ T_INPUT_VOL_MINUS_4DB = 184,
+ T_INPUT_VOL_MINUS_3DB = 186,
+ T_INPUT_VOL_MINUS_2DB = 188,
+ T_INPUT_VOL_MINUS_1DB = 190,
+ T_INPUT_VOL_0DB = 192
+};
static int input_vol_conversion(int vol)
{
- return 255;
-
+ switch(vol) {
+ case T_AUDIO_INPUT_VOL_LEVEL_0:
+ return T_INPUT_VOL_MINUS_96DB;
+ case T_AUDIO_INPUT_VOL_LEVEL_1:
+ return T_INPUT_VOL_MINUS_30DB;
+ case T_AUDIO_INPUT_VOL_LEVEL_2:
+ return T_INPUT_VOL_MINUS_25DB;
+ case T_AUDIO_INPUT_VOL_LEVEL_3:
+ return T_INPUT_VOL_MINUS_20DB;
+ case T_AUDIO_INPUT_VOL_LEVEL_4:
+ return T_INPUT_VOL_MINUS_15DB;
+ case T_AUDIO_INPUT_VOL_LEVEL_5:
+ return T_INPUT_VOL_MINUS_10DB;
+ case T_AUDIO_INPUT_VOL_LEVEL_6:
+ return T_INPUT_VOL_MINUS_7DB;
+ case T_AUDIO_INPUT_VOL_LEVEL_7:
+ return T_INPUT_VOL_MINUS_4DB;
+ case T_AUDIO_INPUT_VOL_LEVEL_8:
+ return T_INPUT_VOL_MINUS_3DB;
+ case T_AUDIO_INPUT_VOL_LEVEL_9:
+ return T_INPUT_VOL_MINUS_2DB;
+ case T_AUDIO_INPUT_VOL_LEVEL_10:
+ return T_INPUT_VOL_MINUS_1DB;
+ case T_AUDIO_INPUT_VOL_LEVEL_11:
+ return T_INPUT_VOL_0DB;
+ default:
+ return T_INPUT_VOL_MINUS_30DB;
+ }
}
+/* yu.dong@20240716 [T106BUG-615]Abnormal whistling tone heard on the side of the phone when dialing in 3G network end */
enum t_output_vol {
T_OUTPUT_VOL_MINUS_96DB = 0,
diff --git a/update_version.sh b/update_version.sh
index b60c396..ff03aa6 100755
--- a/update_version.sh
+++ b/update_version.sh
@@ -1,8 +1,8 @@
#!/bin/bash
#export LYNQ_VERSION="T106_lynq_version_ap_build_sh"
-LYNQ_AP_VERSION="T106-V2.01.01.02P56U06.AP.15.06"
-LYNQ_CAP_INSIDE_VERSION="CAP.15.06"
-LYNQ_CAP_VERSION="CAP.15.06"
+LYNQ_AP_VERSION="T106-W-V2.01.01.02P56U06.AP.15.07"
+LYNQ_CAP_INSIDE_VERSION="CAP.15.07"
+LYNQ_CAP_VERSION="CAP.15.07"
COMMIT_ID="$(git rev-parse HEAD)"
LYNQ_SW_INSIDE_VERSION="LYNQ_CONFIG_VERSION = \"${LYNQ_AP_VERSION}_${LYNQ_CAP_INSIDE_VERSION}\""