Merge "[Feature][ZXW-262][ecall] support ecall, report more ecall state"
diff --git a/allbins/zx297520v3/prj_vehicle/nv/drv_nvrw_0x00012000.bin b/allbins/zx297520v3/prj_vehicle/nv/drv_nvrw_0x00012000.bin
index 856876c..65a0327 100755
--- a/allbins/zx297520v3/prj_vehicle/nv/drv_nvrw_0x00012000.bin
+++ b/allbins/zx297520v3/prj_vehicle/nv/drv_nvrw_0x00012000.bin
Binary files differ
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/conf/distro/vehicle_dc_ref.conf b/cap/zx297520v3/sources/meta-zxic-custom/conf/distro/vehicle_dc_ref.conf
index 51b3f60..5bf2eeb 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/conf/distro/vehicle_dc_ref.conf
+++ b/cap/zx297520v3/sources/meta-zxic-custom/conf/distro/vehicle_dc_ref.conf
@@ -271,6 +271,7 @@
mnet-whitelist-proxy \
flags-tool \
msm-svr \
+ phymiitest \
player-demo \
servicemanager \
service \
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 3e3e049..4c65350 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
@@ -15,6 +15,11 @@
#include <include/lynq-qser-wifi.h>
+void lynq_wifi_event_handle_demo(lynq_wifi_event_s *event, void *arg)
+{
+ printf("[lynq-wifi-demo] %s:%d,%d,%s - %d\n", __func__, event->idx, event->ap_sta_info.connected, event->ap_sta_info.mac, event->status);
+}
+
int main(int argc, char *argv[])
{
if (argc == 2 )
@@ -29,6 +34,10 @@
sprintf(pw, "lynq123456");
qser_wifi_enable(); //enable wifi
qser_wifi_ap_ssid_set(LYNQ_WIFI_AP_INDEX_AP0,"hello"); //Set the ssid of wlan0 to hello
+ if(strcmp(argv[0], "lynq-wifi-demo") == 0)
+ qser_wifi_ap_ssid_hide_set(LYNQ_WIFI_AP_INDEX_AP0,0);
+ else
+ qser_wifi_ap_ssid_hide_set(LYNQ_WIFI_AP_INDEX_AP0,1);
qser_wifi_ap_max_sta_set(LYNQ_WIFI_AP_INDEX_AP0,22); //Example Set the maximum number of connections to 22
qser_wifi_ap_channel_set(LYNQ_WIFI_AP_INDEX_AP0,"CN",13); //Set the country code to CN and channel to 13
qser_wifi_ap_mode_set(LYNQ_WIFI_AP_INDEX_AP0,LYNQ_WIFI_MODE_80211BGN); //Set the working protocol mode of wlan0 to 80211BGN
@@ -38,6 +47,7 @@
else if(strcmp(argv[1], "2") == 0){
char pw[65] = {0};
char ssid[33] = {0};
+ bool hidden = 0;
char country_code[12] = {0};
int channel, max_sta_num;
lynq_wifi_mode_type_e mode;
@@ -47,6 +57,8 @@
qser_wifi_enable(); //enable wifi
ret = qser_wifi_ap_ssid_get(LYNQ_WIFI_AP_INDEX_AP0,ssid); //Gets the ssid of wlan0
printf("[lynq-wifi-demo] ssid=%s ret = %d\n",ssid, ret);
+ ret = qser_wifi_ap_ssid_hide_get(LYNQ_WIFI_AP_INDEX_AP0,&hidden); //Gets whether the ssid state is hidden
+ printf("[lynq-wifi-demo] hidden=%d ret = %d\n",hidden, ret);
ret = qser_wifi_ap_max_sta_get(LYNQ_WIFI_AP_INDEX_AP0,&max_sta_num); //Gets the maximum sta number for wlan0
printf("[lynq-wifi-demo] max_sta_num = %d ret = %d\n",max_sta_num, ret);
ret = qser_wifi_ap_mode_get(LYNQ_WIFI_AP_INDEX_AP0,&mode); //Gets the working protocol mode for wlan0
@@ -58,13 +70,68 @@
ret = qser_wifi_ap_bandwidth_get(LYNQ_WIFI_AP_INDEX_AP0,&bandwidth); //Gets the bandwidth of wlan0
printf("[lynq-wifi-demo] bandwidth = %d ret = %d\n",bandwidth, ret);
}
+ else if(strcmp(argv[1], "3") == 0){
+ qser_wifi_enable(); //enable wifi
+ char ssid[33] = {0};
+ qser_wifi_register_handle(lynq_wifi_event_handle_demo, (void*)ssid);
+ while(1)
+ {
+ sleep(1);
+ }
+ }
+ else if(strcmp(argv[1], "4") == 0){
+ int ret = -1;
+ char ssid[33] = {0};
+ char cmdstr[128]={0};
+ lynq_wifi_sta_param_t stat = {0};
+ qser_wifi_enable(); //enable wifi
+ qser_wifi_register_handle(lynq_wifi_event_handle_demo, (void*)ssid);
+ qser_wifi_ap_start(LYNQ_WIFI_AP_INDEX_AP0); //Set the ap mode of wlan0
+ qser_wifi_sta_start();
+ qser_wifi_sta_start_scan();
+ memset(cmdstr,0,sizeof(cmdstr));
+
+ while (1)
+ {
+ printf("[lynq-wifi-demo]Enter the ssid and password as shown in the following example:ssid auth paris pw ||sta_param_get ||sta_stop\n");
+ if (NULL != fgets(cmdstr, sizeof(cmdstr) - 1, stdin))
+ {
+ if (1 >= strlen(cmdstr))
+ {
+ continue;
+ }
+ if(0 == strncmp(cmdstr, "sta_param_get", strlen(cmdstr) - 1))
+ {
+ ret = qser_wifi_sta_param_get(&stat);
+ printf("[wifi_demo]sta_param_get[%s, %d, %d, %s] ret=%d\n", stat.ssid, stat.auth, stat.pairwise, stat.passwd, ret);
+ continue;
+ }
+ else if(0 == strncmp(cmdstr, "sta_stop", strlen(cmdstr) - 1))
+ {
+ qser_wifi_sta_stop();
+ printf("[lynq-wifi-demo]end \n");
+ break;
+ }
+ else{
+ sscanf(cmdstr, "%s %d %d %s", stat.ssid, &stat.auth, &stat.pairwise, stat.passwd);
+ ret = qser_wifi_sta_param_set(&stat);
+ printf("[lynq-wifi-demo] qser_wifi_sta_param_set ret = %d\n", ret);
+ if(ret == 0)
+ qser_wifi_sta_start();
+ printf("[lynq-wifi-demo]cmdstr = %s\n",cmdstr);
+ }
+ }
+ }
+ }
else{
printf(" [lynq-wifi-demo]Parameter error, please re-enter\n");
}
}
else
{
- printf("[lynq-wifi-demo]Please enter one of the parameters 0,1,2\n");
+ printf("[lynq-wifi-demo]Please enter one of the parameters 0,1,2,3,4\n");
+ printf(" [lynq-wifi-demo]4: sta mode to obtain access point information and set ssid and password and other information connection\n");
+ printf(" [lynq-wifi-demo]3: Obtain sta data information in ap mode\n");
printf(" [lynq-wifi-demo]2: View information such as ssid, password, and channel in ap mode\n");
printf(" [lynq-wifi-demo]1: initializes wifi and enables and sets ap mode\n");
printf(" [lynq-wifi-demo]0: indicates off.\n");
diff --git a/cap/zx297520v3/src/lynq/framework/lynq-atcid/lynq_atsvc_plugin.xml b/cap/zx297520v3/src/lynq/framework/lynq-atcid/lynq_atsvc_plugin.xml
index 3ec11c8..357941c 100755
--- a/cap/zx297520v3/src/lynq/framework/lynq-atcid/lynq_atsvc_plugin.xml
+++ b/cap/zx297520v3/src/lynq/framework/lynq-atcid/lynq_atsvc_plugin.xml
@@ -6,11 +6,11 @@
/>
<module name="/lib/liblynq-qser-gnss.so"
register="lynq_register_gnss"
- cmd="AT+CGPS;AT+CGPSNMEA"
+ cmd="AT+CGPS;AT+CGPSNMEA;AT+NAVSAT;AT+GNSSVER"
/>
<module name="/lib/liblynq-at-common.so"
register="lynq_register_at_common"
- cmd="AT+MNETCALL;AT+GTARNDIS;AT+CGIR;AT+LGMDS;AT+LRNDISHANDLE;AT+LEELSP;AT+NETLED;AT+STATUSLED"
+ cmd="AT+MNETCALL;AT+GTARNDIS;AT+CGIR;AT+LGMDS;AT+LRNDISHANDLE;AT+LEELSP;AT+NETLED;AT+STATUSLED;AT+DDRID"
/>
<module name="/lib/liblynq-at-factory.so"
register="lynq_register_at_factory"
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-at-common/liblynq-at-common.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-at-common/liblynq-at-common.cpp
index 391d43c..1ff7efa 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-at-common/liblynq-at-common.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-at-common/liblynq-at-common.cpp
@@ -110,12 +110,51 @@
return;
}
+#define mem_addr_lenth 10
+void lynq_handle_ddr_identify()
+{
+ char buf[64] = {0};
+ char *command = "devmem 0x0121b040";
+ char result[64] = {0};
+ FILE *fp;
+
+ fp = popen(command, "r");
+ if(fp == NULL)
+ {
+ lynq_response_error(100);
+ return;
+ }
+ fgets(result, sizeof(result), fp);
+ pclose(fp);
+
+ if(strncmp(result,"0xF8631600",mem_addr_lenth) == 0 || strncmp(result,"0xF8631700",mem_addr_lenth) == 0)
+ {
+ sprintf(buf,"+DDRID:2Gb ddr\r\n");
+ handle_output(buf, strlen(buf), Response);
+ }
+ else if(strncmp(result,"0xF8631300",mem_addr_lenth) == 0 || strncmp(result,"0xF8631500",mem_addr_lenth) == 0)
+ {
+ sprintf(buf,"+DDRID:4Gb ddr\r\n");
+ handle_output(buf, strlen(buf), Response);
+ }
+ else
+ {
+ sprintf(buf,"+DDRID:no matching ddr\r\n");
+ handle_output(buf, strlen(buf), Response);
+ lynq_response_error(100);
+ return;
+ }
+ lynq_response_ok();
+ return;
+}
+
static Command commands[] =
{
{"CGIR",lynq_handle_version},
{"LEELSP",lynq_handle_autosuspend},
{"NETLED",lynq_handle_netled},
{"STATUSLED",lynq_handle_statusled},
+ {"DDRID",lynq_handle_ddr_identify},
{NULL, NULL}
};
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/include/mbtk_gnss_internal.h b/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/include/mbtk_gnss_internal.h
index 5ae667a..c6486d8 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/include/mbtk_gnss_internal.h
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/include/mbtk_gnss_internal.h
@@ -202,6 +202,38 @@
char nmea_ver[4];
};
+static const char *enableMask[]=
+ {
+ "GPS L1",
+ "GLONASS G1",
+ "BEIDOU B1",
+ "",
+ "GALILEO E1",
+ "QZSS L1",
+ "SBAS L1",
+ "IRNSS L5",
+ "GPS L1C",
+ "GPS L5",
+ "GPS L2C",
+ "",
+ "",
+ "GLONASS G2",
+ "BEIDOU B1C",
+ "BEIDOU B2A",
+ "BEIDOU B3I",
+ "BEIDOU B5",
+ "BEIDOU B2",
+ "",
+ "GALILEO E5A",
+ "GALILEO E5B",
+ "GALILEO E6",
+ "",
+ "QZSS L6",
+ "QZSS L1C",
+ "QZSS L5",
+ "QZSS L2C"
+ };
+
#ifdef DEBUG
#define gnss_log(...) printf(__VA_ARGS__)
#else
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/src/lynq_qser_gnss.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/src/lynq_qser_gnss.cpp
index e2e4833..c976162 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/src/lynq_qser_gnss.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/src/lynq_qser_gnss.cpp
@@ -45,7 +45,7 @@
int g_gnss_sync_enable_flag = 0;
int g_gnss_sync_done = 0;
int inited = 0;
-
+int event = 0;
int qser_Gnss_Init(uint32_t *h_gnss)
{
ret = lynq_gnss_client_init(h_gnss);
@@ -472,10 +472,10 @@
int lynq_at_cgps(int at_type,int gnss_state_type);
int lynq_at_cgpsnmea(int at_type,int gnss_state_type);
lynq_atsvc_outcb atsvc_gnss_outcb;
+uint32_t h_gnss;
int at_gps_status = 0;
int at_gpsnmea_status = 0;
int pthread_state = 1;
-int tty_fd = -1;
int device_fd = -1;
int strUpper(char * str)
@@ -520,45 +520,77 @@
int gps_channel_init()
{
int ret = 0;
- tty_fd = open("/dev/ttyS2", O_RDWR);
- ALOGD("tty_fd:%d\n",tty_fd);
- if (tty_fd == -1)
- {
- ALOGE("Failed to open serial port\n");
- return -1;
- }
device_fd = open("/dev/armps_rpmsgch30", O_RDWR);//30 is AT-channel;31 is modem-channel
ALOGD("device_fd:%d\n",device_fd);
if (device_fd == -1)
{
ALOGE("Failed to open device file\n");
- close(tty_fd);
return -1;
}
ret = channel_config(device_fd);
if(ret < 0)
{
- close(tty_fd);
close(device_fd);
return -1;
}
return 0;
}
-void read_gps_data()
+time_t start;
+time_t end;
+int lynq_at_navsat(uint32_t h_gnss)
{
- char gnss_buf[256];
- while (at_gpsnmea_status)
+ struct mbtk_gnss_handle_t *gnss_handle = (struct mbtk_gnss_handle_t *)h_gnss;
+ event = 1;
+ char send_buf[] = {0xF1,0xD9,0x06,0x0C,0x00,0x00,0x12,0x3C};
+ ret = write(gnss_handle->dev_fd, send_buf, sizeof(send_buf));
+ if(ret < 0)
{
- bzero(gnss_buf,256);
- ssize_t gnss_lenth = read(tty_fd, gnss_buf, sizeof(gnss_buf));
- if (gnss_lenth > 0)
+ ALOGE("send navsat faild");
+ return -1;
+ }
+ time(&start);
+ while(event)
+ {
+ usleep(500000);
+ time(&end);
+ if(difftime(end,start) > 2)
{
- write(device_fd, gnss_buf, gnss_lenth);
+ return -1;
}
}
- pthread_state = 0;
- return;
+
+ return 0;
+}
+
+int lynq_at_gnssver(uint32_t h_gnss)
+{
+ struct mbtk_gnss_handle_t *gnss_handle = (struct mbtk_gnss_handle_t *)h_gnss;
+ event = 2;
+ char send_buf[] = {0xF1,0xD9,0x0A,0x04,0x00,0x00,0x0E,0x34};
+ ret = write(gnss_handle->dev_fd, send_buf, sizeof(send_buf));
+ if(ret < 0)
+ {
+ ALOGE("send gnssver faild");
+ return -1;
+ }
+ time(&start);
+ while(event)
+ {
+ usleep(500000);
+ time(&end);
+ if(difftime(end,start) > 2)
+ {
+ return -1;
+ }
+ }
+ return 0;
+}
+
+void at_callback(uint32_t h_loc,e_msg_id_t e_msg_id,void *pv_data,void *context_ptr)
+{
+ mopen_gnss_nmea_info_t *pt_nmea = (mopen_gnss_nmea_info_t *)pv_data;
+ write(device_fd, pt_nmea->nmea, strlen(pt_nmea->nmea));
}
int gnss_at_cmd_parse(char *cmd,char *parse_cmd,int* gnss_state_type,int* at_type)
@@ -647,9 +679,7 @@
}
if (at_gps_status == 0)
{
- lynq_open_gps(0);
- close(device_fd);
- close(tty_fd);
+ qser_Gnss_Deinit(h_gnss);
}
else if(at_gps_status == 1)
{
@@ -658,20 +688,8 @@
{
return -1;
}
- lynq_open_gps(1);
- #if defined(HD_GNSS)
- ret = set_baudrate(tty_fd, B115200);
- if(-1 == ret)
- {
- return -2;
- }
- #elif defined(HX_GNSS)
- ret = set_baudrate(tty_fd, B9600);
- if(-1 == ret)
- {
- return -2;
- }
- #endif
+ qser_Gnss_Init(&h_gnss);
+ qser_AddRxIndMsgHandler(&at_callback,h_gnss);
}
else
{
@@ -715,21 +733,11 @@
if (at_gpsnmea_status == 0)
{
- ALOGD("gpsnmea_status = %d\n",at_gpsnmea_status);
- for(int i = 0;i < 20;i++)
- {
- if(pthread_state == 0)
- {
- ALOGD("pthread down\n");
- sleep(1);
- break;
- }
- }
+ qser_Gnss_Stop(h_gnss);
}
else if(at_gpsnmea_status == 1)
{
- ALOGE("gpsnmea_status = %d\n",at_gpsnmea_status);
- pthread_create(&thread, NULL, read_gps_data, NULL);
+ qser_Gnss_Start(h_gnss);
}
else
@@ -747,7 +755,6 @@
int res = 0;
int income_at_type = 0;
int gnss_state_type = -1;
- //char at_cmd[128]={0};
char gnss_at_cmd[64] = {0};
char parse_atcmd[128] = {0};
if(NULL == input)
@@ -786,6 +793,26 @@
return;
}
}
+ else if (!strcmp(parse_atcmd, "AT+NAVSAT"))
+ {
+ res = lynq_at_navsat(h_gnss);
+ if (res != 0)
+ {
+ sprintf(gnss_at_cmd,"+CME ERROR: 100\r\n");
+ atsvc_gnss_outcb(gnss_at_cmd,strlen(gnss_at_cmd),0);
+ return;
+ }
+ }
+ else if (!strcmp(parse_atcmd, "AT+GNSSVER"))
+ {
+ res = lynq_at_gnssver(h_gnss);
+ if (res != 0)
+ {
+ sprintf(gnss_at_cmd,"+CME ERROR: 100\r\n");
+ atsvc_gnss_outcb(gnss_at_cmd,strlen(gnss_at_cmd),0);
+ return;
+ }
+ }
sprintf(gnss_at_cmd,"OK\r\n");
atsvc_gnss_outcb(gnss_at_cmd,strlen(gnss_at_cmd),0);
return;
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/src/mbtk_gnss.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/src/mbtk_gnss.cpp
index 0bb8d1f..d4b774f 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/src/mbtk_gnss.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/src/mbtk_gnss.cpp
@@ -29,7 +29,8 @@
extern long timezone;
extern int g_gnss_sync_enable_flag;
extern int g_gnss_sync_done;
-
+extern int event;
+extern int device_fd;
typedef int (*sc_rtc_time_get_cb)(unsigned int src_id, unsigned long ulsec);
extern int sc_rtc_timer_init(void);
extern int sc_rtc_timer_uninit(void);
@@ -37,7 +38,6 @@
extern int sc_cfg_get(char *name, char* buf, int bufLen);
extern int sc_cfg_set (char *name, char *value);
-
static inline int update_system_time(time_t timestamp)
{
struct timeval tv;
@@ -81,6 +81,22 @@
return ret;
}
+void navsat(char *data,char *result)
+{
+ int nav_info = *((int*)(data+6));
+ for (int i = 0; i < 28; i++)
+ {
+ if ((nav_info & (1 << i)) != 0)
+ {
+ if (strlen(result) > 0)
+ {
+ strcat(result, "+");
+ }
+ strcat(result, enableMask[i]);
+ }
+ }
+}
+
struct mbtk_gnss_handle_t
{
int dev_fd;
@@ -501,11 +517,11 @@
nmea_info.length = data_len;
memcpy(nmea_info.nmea, data, data_len);
//gnss_log("nmea:[%d] %s", data_len, data);
- if( handle->mode == 3 && nmea_info.timestamp &&handle->gnss_handler_func)
+ if(handle->gnss_handler_func)//handle->mode == 3 && nmea_info.timestamp &&
{
handle->gnss_handler_func((uint32)handle, E_MT_LOC_MSG_ID_NMEA_INFO, &nmea_info, NULL);
}
- if(handle->gnss_handler_func && handle->mode == 1 && mopen_location_info.timestamp && mopen_location_info.flags)
+ else if(handle->mode == 1 && handle->gnss_handler_func && mopen_location_info.timestamp && mopen_location_info.flags)
{
handle->gnss_handler_func((uint32)handle, E_MT_LOC_MSG_ID_LOCATION_INFO, &mopen_location_info, NULL);
@@ -541,45 +557,34 @@
*/
static int get_gnss_from_str(struct mbtk_gnss_handle_t *handle, char *data, int data_len)
{
- char *tail = NULL;
- static int seek = 0;
- // 等待 OK, 如果20条结果没有等到,就异常
- static int reset_count = 0;
- int i = 0, ret = -1;
-
- if (handle->reset_state)
+ if(event)
{
- // 等待 reset 回复的 OK
- if(0 != memcmp(data, "$OK", 3) && reset_count < 20) {
- printf("gnss reset invalid: [%s]\n", data);
- reset_count++;
- return -1;
+ char tar[] = {0xF1,0xD9};
+ char tar2[] = {0x04,0x20};
+ char result[64] = {0};
+ char buf[64];
+ if(strncmp(data,tar,2) == 0 && event == 1)
+ {
+ navsat(data,result);
+ sprintf(buf, "+Navsat:%s\n", result);
+ event = 0;
+ write(device_fd, buf, strlen(buf));
}
- if (reset_count > 19) {
- printf("%s: device reset timeout!!!\n", __FUNCTION__);
- LOGI("%s: device reset timeout!!!\n", __FUNCTION__);
+ else if(strncmp(data,tar2,2) == 0 && event == 2)
+ {
+ sprintf(buf,"+Gnssver:%.11s\n", data+19);//The 19th word of this statement starts with the software version number, which is a total of 11 words
+ event = 0;
+ write(device_fd, buf, strlen(buf));
}
- reset_count = 0;
- gnss_log("reset ok: %s\n", data);
-#if BAUDRATE_115200
- ret = mopen_uart_change(handle->dev_fd, 0);
- if(ret) {
- printf("reset Uart set 115200 error\n");
- }
-#endif
- pthread_mutex_lock(&handle->_cond_mutex);
- handle->reset_state = 0;
- pthread_mutex_unlock(&handle->_cond_mutex);
+ memset(result,0,sizeof(result));
+ memset(buf,0,sizeof(result));
}
if((data[0] == '$' || data[0] == '#') &&
data[data_len - 1] == '\n' &&
data_len < 128) {
process_gnss_callback(handle, data, data_len);
- } else {
- gnss_log("nmea error: %s\n", data);
}
-
return 1;
}
@@ -790,7 +795,6 @@
ret = ring_buffer_dequeue_arr(&gnss_handle->ring_buffer, tmp_arr, i + 1);
if(ret > 0 && 0 == mbtk_gnss_handle->getap_status) {
- // gnss_log("NEMA:[%d] %s", ret, tmp_arr);
get_gnss_from_str(gnss_handle, tmp_arr, ret);
memset(tmp_arr, 0, sizeof(tmp_arr));
} else {
@@ -825,7 +829,6 @@
ret = mopen_gnss_read(gnss_handle->dev_fd, buf, MBTK_UART_RECV_BUFFER_SIZE);
nmea_reading = 0;
if(ret > 0) {
- printf("%s\n",buf);
ring_buffer_queue_arr(&gnss_handle->ring_buffer, buf, ret);
memset(buf, 0, sizeof(buf));
} else {
@@ -942,14 +945,8 @@
}
#if defined(HD_GNSS)
- test_gpio_handle[15] = sc_gpio_init(15,1,0,0);
+ test_gpio_handle[15] = sc_gpio_init(15,0,0,0);
test_gpio_handle[84] = sc_gpio_init(84,1,0,0);
- ret = sc_gpio_value_set(test_gpio_handle[15],0);
- if(ret)
- {
- ALOGE("gpio15 set value 0 error\n");
- }
- usleep(10000);
ret = sc_gpio_value_set(test_gpio_handle[84],0);
if(ret)
{
@@ -970,14 +967,8 @@
{
nmea_state = 1;
#if defined(HD_GNSS)
- test_gpio_handle[15] = sc_gpio_init(15,1,0,0);
test_gpio_handle[84] = sc_gpio_init(84,1,0,0);
- ret = sc_gpio_value_set(test_gpio_handle[15],1);
- if(ret)
- {
- ALOGE("gpio15 set value 1 error\n");
- }
- usleep(10000);
+ test_gpio_handle[15] = sc_gpio_init(15,0,0,0);
ret = sc_gpio_value_set(test_gpio_handle[84],1);
if(ret)
{
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-wifi/include/lynq-qser-wifi.h b/cap/zx297520v3/src/lynq/lib/liblynq-qser-wifi/include/lynq-qser-wifi.h
index fa021c0..a7ed3d5 100644
--- a/cap/zx297520v3/src/lynq/lib/liblynq-qser-wifi/include/lynq-qser-wifi.h
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-wifi/include/lynq-qser-wifi.h
@@ -54,10 +54,61 @@
LYNQ_WIFI_AUTH_MAX
} lynq_wifi_auth_e;
+typedef enum {
+ LYNQ_WIFI_STATUS_ENABLE = 0,
+ LYNQ_WIFI_STATUS_DISABLE,
+ LYNQ_WIFI_STATUS_ERR_DRIVER,
+ LYNQ_WIFI_STATUS_ERR_SOFTWARE,
+} lynq_wifi_status_e;
+
+typedef enum {
+ LYNQ_WIFI_STATION_DISABLE = 0, /* WiFi station is not enable */
+ LYNQ_WIFI_STATION_CONNECTED, /* WiFi station is connected hotspot */
+ LYNQ_WIFI_STATION_DISCONNECTED /* WiFi station is disconnect hotspot */
+} lynq_wifi_station_status_e;
+
+typedef enum
+{
+ LYNQ_WIFI_AUTH_WPA_PAIRWISE_MIN = -1,
+ LYNQ_WIFI_AUTH_WPA_PAIRWISE_AUTO = 0, //TKIP & AES
+ LYNQ_WIFI_AUTH_WPA_PAIRWISE_TKIP,
+ LYNQ_WIFI_AUTH_WPA_PAIRWISE_AES,
+ LYNQ_WIFI_AUTH_WPA_PAIRWISE_MAX
+} lynq_wifi_auth_wpa_psk_e;
+
+typedef struct {
+ lynq_wifi_ap_index_e idx;
+ union {
+ /* the LYNQ_WIFI_ENABLE_STATUS or LYNQ_WIFI_DISABLE_STATUS event */
+ lynq_wifi_status_e status;
+ struct {
+ /*
+ * If connected is true, the station is connected wifi hotspot.
+ * If connected is false, the station is disconnected wifi hotspot.
+ */
+ int connected;
+ char mac[18];
+ } ap_sta_info;
+ lynq_wifi_station_status_e sta_status;
+ };
+} lynq_wifi_event_s;
+
+ typedef struct
+ {
+ char ssid[33];
+ lynq_wifi_auth_e auth; //only aic support wap3
+ lynq_wifi_auth_wpa_psk_e pairwise;
+ char passwd[64 + 1];
+ } lynq_wifi_sta_param_t;
+
+typedef void (*lynq_wifi_event_handle)(lynq_wifi_event_s *event, void *arg);
+
int qser_wifi_enable(void);
int qser_wifi_disable(void);
int qser_wifi_ap_ssid_set(lynq_wifi_ap_index_e idx, const char *ssid);
int qser_wifi_ap_ssid_get(lynq_wifi_ap_index_e idx, char *ssid);
+int qser_wifi_ap_ssid_hide_set(lynq_wifi_ap_index_e idx, bool hide);
+int qser_wifi_ap_ssid_hide_get(lynq_wifi_ap_index_e idx, bool *hide);
int qser_wifi_ap_mode_set(lynq_wifi_ap_index_e idx, lynq_wifi_mode_type_e mode);
int qser_wifi_ap_mode_get(lynq_wifi_ap_index_e idx, lynq_wifi_mode_type_e *mode);
int qser_wifi_ap_bandwidth_set(lynq_wifi_ap_index_e idx, lynq_wifi_bandwidth_type_e bandwidth);
@@ -71,6 +122,13 @@
int qser_wifi_ap_start(lynq_wifi_ap_index_e idx);
int qser_wifi_ap_stop(lynq_wifi_ap_index_e idx);
int qser_wifi_ap_restart(lynq_wifi_ap_index_e idx);
+int qser_wifi_register_handle(lynq_wifi_event_handle event_handle, void *arg);
+int qser_wifi_sta_param_set(lynq_wifi_sta_param_t *lynq_stat);
+int qser_wifi_sta_param_get(lynq_wifi_sta_param_t *lynq_stat);
+int qser_wifi_sta_start_scan(void);
+int qser_wifi_sta_start(void);
+int qser_wifi_sta_stop(void);
+
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-wifi/lynq-qser-wifi.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-qser-wifi/lynq-qser-wifi.cpp
index 91f1112..664fcbe 100644
--- a/cap/zx297520v3/src/lynq/lib/liblynq-qser-wifi/lynq-qser-wifi.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-wifi/lynq-qser-wifi.cpp
@@ -11,6 +11,233 @@
#include "sc_wifi.h"
#include "lynq-qser-wifi.h"
+static lynq_wifi_event_handle wifi_event_handle = NULL;
+static void *global_arg = NULL;
+static lynq_wifi_event_s global_event ;
+
+/********************************************************************
+* @brief: lynq_to_sc_auth_mode, The encryption mode of wifi is changed from api to platform
+* @return : NA
+* @todo: NA
+* @see: NA
+* @warning: NA
+*********************************************************************/
+static sc_wifi_auth_e lynq_to_sc_auth_mode(lynq_wifi_auth_e auth_mode)
+{
+ sc_wifi_auth_e type;
+ switch (auth_mode)
+ {
+ case LYNQ_WIFI_AUTH_OPEN:
+ type = SC_WIFI_AUTH_OPEN;
+ break;
+ case LYNQ_WIFI_AUTH_WPA2_PSK:
+ type = SC_WIFI_AUTH_WPA2_PSK;
+ break;
+ case LYNQ_WIFI_AUTH_WPA_WPA2_PSK_BOTH:
+ type = SC_WIFI_AUTH_WPA_WPA2_PSK_BOTH;
+ break;
+ case LYNQ_WIFI_AUTH_WPA3_PSK:
+ type = SC_WIFI_AUTH_WPA3_PSK;
+ break;
+ case LYNQ_WIFI_AUTH_WPA2_WPA3_PSK_BOTH:
+ type = SC_WIFI_AUTH_WPA2_WPA3_PSK_BOTH;
+ break;
+ default:
+ type = SC_WIFI_AUTH_MIN;
+ break;
+ }
+ return type;
+}
+
+/********************************************************************
+* @brief: sc_to_lynq_auth_mode, The encryption mode of wifi is changed from platform to api
+* @return : NA
+* @todo: NA
+* @see: NA
+* @warning: NA
+*********************************************************************/
+static lynq_wifi_auth_e sc_to_lynq_auth_mode(sc_wifi_auth_e auth_mode)
+{
+ lynq_wifi_auth_e type;
+ switch (auth_mode)
+ {
+ case SC_WIFI_AUTH_OPEN:
+ type = LYNQ_WIFI_AUTH_OPEN;
+ break;
+ case SC_WIFI_AUTH_WPA2_PSK:
+ type = LYNQ_WIFI_AUTH_WPA2_PSK;
+ break;
+ case SC_WIFI_AUTH_WPA_WPA2_PSK_BOTH:
+ type = LYNQ_WIFI_AUTH_WPA_WPA2_PSK_BOTH;
+ break;
+ case SC_WIFI_AUTH_WPA3_PSK:
+ type = LYNQ_WIFI_AUTH_WPA3_PSK;
+ break;
+ case SC_WIFI_AUTH_WPA2_WPA3_PSK_BOTH:
+ type = LYNQ_WIFI_AUTH_WPA2_WPA3_PSK_BOTH;
+ break;
+ default:
+ type = LYNQ_WIFI_AUTH_MIN;
+ break;
+ }
+ return type;
+}
+
+/********************************************************************
+* @brief: lynq_user_status, wifi startup callback
+* @return : NA
+* @todo: NA
+* @see: NA
+* @warning: NA
+*********************************************************************/
+static void lynq_user_status(sc_wifi_enable_status_e pre_status, sc_wifi_enable_status_e status)
+{
+ LYINFLOG("%s:%d,%d\n", __func__, pre_status, status);
+}
+
+/********************************************************************
+* @brief: lynq_user_wifi_service_error, wifi service status callback
+* @return : NA
+* @todo: NA
+* @see: NA
+* @warning: NA
+*********************************************************************/
+static void lynq_user_wifi_service_error(int error)
+{
+ LYINFLOG("%s: %d\n", __func__, error);
+}
+
+/********************************************************************
+* @brief: lynq_user_ap_status, wifi Obtains the ap status callback
+* @return : NA
+* @todo: NA
+* @see: NA
+* @warning: NA
+*********************************************************************/
+static void lynq_user_ap_status(sc_wifi_ap_index_e index, sc_wifi_ap_status_e pre_status, sc_wifi_ap_status_t *p_msg)
+{
+ if(wifi_event_handle != NULL && global_arg != NULL)
+ {
+ global_event.idx = (lynq_wifi_ap_index_e)index;
+ global_event.status = (lynq_wifi_status_e)pre_status;
+ wifi_event_handle(&global_event, global_arg);
+ }
+ else{
+ LYINFLOG("%s:%d,%d,%s,%d\n", __func__, index, pre_status, p_msg->ifname, p_msg->status);
+ }
+
+}
+
+/********************************************************************
+* @brief: lynq_user_ap_sta_conn_status, wifi as ap is sta information callback
+* @return : NA
+* @todo: NA
+* @see: NA
+* @warning: NA
+*********************************************************************/
+static void lynq_user_ap_sta_conn_status(sc_wifi_ap_index_e index, sc_wifi_sta_connect_status_t *p_msg)
+{
+ if(wifi_event_handle != NULL && global_arg != NULL)
+ {
+ global_event.idx = (lynq_wifi_ap_index_e)index;
+ global_event.ap_sta_info.connected = p_msg->is_connected;
+ strncpy(global_event.ap_sta_info.mac, p_msg->macaddr,
+ sizeof(global_event.ap_sta_info.mac) <= sizeof(p_msg->macaddr) ? sizeof(global_event.ap_sta_info.mac):sizeof(p_msg->macaddr));
+ wifi_event_handle(&global_event, global_arg);
+ }
+ else{
+ LYINFLOG("%s:%d,%d,%s\n", __func__, index, p_msg->is_connected, p_msg->macaddr);
+ }
+
+}
+
+/********************************************************************
+* @brief: print_sta_status, wifi gets the status callback in sta mode
+* @return : NA
+* @todo: NA
+* @see: NA
+* @warning: NA
+*********************************************************************/
+static void print_sta_status(sc_wifi_sta_status_t *p_msg)
+{
+ LYINFLOG("%s: %d, %s, %s, %d, %d\n", __func__, p_msg->status, p_msg->ifname, p_msg->ap_bssid,
+ p_msg->signal_level, p_msg->reason_code);
+
+ if (p_msg->has_addr == 1) {
+ char addrtxt[48] = {0};
+ inet_ntop(AF_INET, &p_msg->addr, addrtxt, sizeof(addrtxt));
+ LYINFLOG("%s : addr inet_ntop: %s\n", __func__, addrtxt);
+
+ LYINFLOG("%s : addr: %08X\n", __func__, p_msg->addr.s_addr);
+ }
+
+ if (p_msg->has_addr6 == 1) {
+ char addrtxt[48] = {0};
+ inet_ntop(AF_INET6, &p_msg->addr6, addrtxt, sizeof(addrtxt));
+ LYINFLOG("%s : addr6 inet_ntop: %s\n", __func__, addrtxt);
+
+ LYINFLOG("%s : addr6: %02X%02X:%02X%02X:%02X%02X:%02X%02X:%02X%02X:%02X%02X:%02X%02X:%02X%02X\n",__func__,
+ p_msg->addr6.s6_addr[0], p_msg->addr6.s6_addr[1], p_msg->addr6.s6_addr[2], p_msg->addr6.s6_addr[3],
+ p_msg->addr6.s6_addr[4], p_msg->addr6.s6_addr[5], p_msg->addr6.s6_addr[6], p_msg->addr6.s6_addr[7],
+ p_msg->addr6.s6_addr[8], p_msg->addr6.s6_addr[9], p_msg->addr6.s6_addr[10], p_msg->addr6.s6_addr[11],
+ p_msg->addr6.s6_addr[12], p_msg->addr6.s6_addr[13], p_msg->addr6.s6_addr[14], p_msg->addr6.s6_addr[15]);
+ }
+ LYINFLOG("%s : sta_status end\n",__func__);
+}
+
+/********************************************************************
+* @brief: lynq_user_sta_status_ind, wifi gets the status callback in sta mode
+* @return : NA
+* @todo: NA
+* @see: NA
+* @warning: NA
+*********************************************************************/
+static void lynq_user_sta_status_ind(sc_wifi_sta_status_e pre_status,
+ sc_wifi_sta_status_t *p_msg)
+{
+ LYINFLOG("%s : user_sta_status_ind_cb pre:%d, cur:%d\n", __func__, pre_status, p_msg->status);
+ print_sta_status(p_msg);
+}
+
+/********************************************************************
+* @brief: lynq_user_sta_scan_result_ind, wifi gets the callback of sta mode traversing the hotspot
+* @return : NA
+* @todo: NA
+* @see: NA
+* @warning: NA
+*********************************************************************/
+static void lynq_user_sta_scan_result_ind(sc_wifi_sta_scan_list_t *p_msg)
+{
+ int i = 0;
+ LYINFLOG("%s : user_sta_scan_result_ind_cb:%d\n", __func__, p_msg->cnt);
+ if (p_msg->cnt <= 0) {
+ return;
+ }
+ for (i = 0; i < p_msg->cnt; i++) {
+ LYINFLOG("%s : ap[%d]:%s,%d,%d,%d,%s,%d\n", __func__, i, p_msg->info[i].essid, sc_to_lynq_auth_mode(p_msg->info[i].auth),
+ p_msg->info[i].cipher, p_msg->info[i].channel, p_msg->info[i].bssid, p_msg->info[i].signal_level);
+ }
+}
+
+/********************************************************************
+* @brief: qser_wifi_register_handle, Register callback functions
+* @return :int, If equal to 0 succeeds, others fail
+* @todo: NA
+* @see: NA
+* @warning: NA
+*********************************************************************/
+int qser_wifi_register_handle(lynq_wifi_event_handle event_handle, void *arg)
+{
+ if(event_handle == NULL || arg == NULL)
+ {
+ LYERRLOG("[%s ] NUll pointer event_handle = 0x%p arg = 0x%p\n", __func__, event_handle, arg);
+ return -1;
+ }
+ wifi_event_handle = event_handle;
+ global_arg = arg;
+ return 0;
+}
+
/********************************************************************
* @brief: qser_wifi_enable, Enable WiFi function
* @return : int, If equal to 0 succeeds, others fail
@@ -24,14 +251,57 @@
ret = sc_wifi_init();
if (0 != ret)
{
- LYERRLOG("[%s ] init : %d ret = %d\n", __func__,ret);
+ LYERRLOG("[%s ] init wifi ret = %d fail\n", __func__,ret);
+ return ret;
+ }
+
+ //wifi
+ ret = sc_wifi_set_enable_status_ind_cb(lynq_user_status);
+ if (0 != ret)
+ {
+ LYERRLOG("[%s ] Request lynq_user_status ret = %d fail\n", __func__,ret);
+ return ret;
+ }
+
+ //ap
+ ret = sc_wifi_ap_set_status_ind_cb(lynq_user_ap_status);
+ if (0 != ret)
+ {
+ LYERRLOG("[%s ] Request lynq_user_ap_status ret = %d fail\n", __func__,ret);
+ return ret;
+ }
+ ret = sc_wifi_set_ap_sta_connect_ind_cb(lynq_user_ap_sta_conn_status);
+ if (0 != ret)
+ {
+ LYERRLOG("[%s ] Request lynq_user_ap_sta_conn_status ret = %d fail\n", __func__,ret);
+ return ret;
+ }
+
+ //sta
+ ret = sc_wifi_sta_set_status_ind_cb(lynq_user_sta_status_ind);
+ if (0 != ret)
+ {
+ LYERRLOG("[%s ] Request lynq_user_sta_status_ind ret = %d fail\n", __func__,ret);
+ return ret;
+ }
+ ret = sc_wifi_sta_set_scan_result_ind_cb(lynq_user_sta_scan_result_ind);
+ if (0 != ret)
+ {
+ LYERRLOG("[%s ] Request lynq_user_sta_scan_result_ind ret = %d fail\n", __func__,ret);
+ return ret;
+ }
+ //proxy
+ ret = sc_wifi_set_service_error_cb(lynq_user_wifi_service_error);
+ if (0 != ret)
+ {
+ LYERRLOG("[%s ] Request lynq_user_wifi_service_error ret = %d fail\n", __func__,ret);
return ret;
}
ret = sc_wifi_enable();
if (0 != ret)
{
- LYERRLOG("[%s ] enable : %d ret = %d\n", __func__,ret);
+ LYERRLOG("[%s ] enable wifi ret = %d fail\n", __func__,ret);
return ret;
}
LYINFLOG("[%s ]\n", __func__);
@@ -117,6 +387,57 @@
}
/********************************************************************
+* @brief: qser_wifi_ap_ssid_hide_set, Set whether the ssid of wlan0 or wlan1 is hidden
+* @param idx [IN]: int, Set wlan0 or wlan1
+* @param hide [IN]: bool, Set whether the ssid is hidden
+* @return : int, If equal to 0 succeeds, others fail
+* @todo: NA
+* @see: NA
+* @warning: NA
+*********************************************************************/
+int qser_wifi_ap_ssid_hide_set(lynq_wifi_ap_index_e idx, bool hide)
+{
+ int ret = -1;
+ ret = sc_wifi_ap_ssid_hidden_set((sc_wifi_ap_index_e)idx, (int)hide);
+ if (0 != ret)
+ {
+ LYERRLOG("[%s ] ret = %d\n", __func__,ret);
+ return ret;
+ }
+ LYINFLOG("[%s ] idx = %d hide = %d \n", __func__, idx, hide);
+ return 0;
+}
+
+/********************************************************************
+* @brief: qser_wifi_ap_ssid_hide_get, Get whether the ssid of wlan0 or wlan1 is hidden
+* @param idx [IN]: int, Set wlan0 or wlan1
+* @param hide [OUT]: bool *, Get whether the ssid is hidden
+* @return : int, If equal to 0 succeeds, others fail
+* @todo: NA
+* @see: NA
+* @warning: NA
+*********************************************************************/
+int qser_wifi_ap_ssid_hide_get(lynq_wifi_ap_index_e idx, bool *hide)
+{
+ int ret = -1;
+ sc_wifi_ap_param_t param = {0};
+ if (hide == NULL)
+ {
+ LYERRLOG("[%s ] Null pointer hide = 0x%p \n", __func__, hide);
+ return ret;
+ }
+ ret = sc_wifi_ap_param_get((sc_wifi_ap_index_e)idx, ¶m);
+ if (0 != ret)
+ {
+ LYERRLOG("[%s ] ret = %d\n", __func__,ret);
+ return ret;
+ }
+ LYINFLOG("[%s ] idx = %d ssid_hide = %d \n", __func__, idx, param.ssid_hide);
+ *hide = (bool)param.ssid_hide;
+ return 0;
+}
+
+/********************************************************************
* @brief: qser_wifi_ap_mode_set, Set the working protocol mode of wlan0 or wlan1
* @param idx [IN]: int, Set wlan0 or wlan1
* @param mode [IN]: lynq_wifi_mode_type_e, Set the working protocol mode
@@ -316,35 +637,14 @@
int qser_wifi_ap_auth_set(lynq_wifi_ap_index_e idx, lynq_wifi_auth_e auth_mode, const char *auth_passwd)
{
int ret = -1;
- sc_wifi_auth_e type;
if (auth_passwd == NULL)
{
LYERRLOG("[%s ] Null pointer auth_passwd = 0x%p\n", __func__, auth_passwd);
return ret;
}
- switch (auth_mode)
- {
- case LYNQ_WIFI_AUTH_OPEN:
- type = SC_WIFI_AUTH_OPEN;
- break;
- case LYNQ_WIFI_AUTH_WPA2_PSK:
- type = SC_WIFI_AUTH_WPA2_PSK;
- break;
- case LYNQ_WIFI_AUTH_WPA_WPA2_PSK_BOTH:
- type = SC_WIFI_AUTH_WPA_WPA2_PSK_BOTH;
- break;
- case LYNQ_WIFI_AUTH_WPA3_PSK:
- type = SC_WIFI_AUTH_WPA3_PSK;
- break;
- case LYNQ_WIFI_AUTH_WPA2_WPA3_PSK_BOTH:
- type = SC_WIFI_AUTH_WPA2_WPA3_PSK_BOTH;
- break;
- default:
- type = SC_WIFI_AUTH_MIN;
- break;
- }
+
sc_wifi_ap_auth_t auth;
- auth.auth = (sc_wifi_auth_e)type;
+ auth.auth = lynq_to_sc_auth_mode(auth_mode);
strncpy(auth.passwd, auth_passwd, sizeof(auth.passwd) - 1);
ret = sc_wifi_ap_auth_set((sc_wifi_ap_index_e)idx, &auth);
if (0 != ret)
@@ -352,7 +652,7 @@
LYERRLOG("[%s ] ret = %d\n", __func__,ret);
return ret;
}
- LYINFLOG("[%s ] idx = %d auth_mode = %d auth_passwd = %s\n", __func__, idx, auth_mode, auth_passwd);
+ LYINFLOG("[%s ] idx = %d auth_mode = %d auth_passwd = %s\n", __func__, idx, auth_mode, "******");
return 0;
}
@@ -383,29 +683,8 @@
}
LYINFLOG("[%s ] idx = %d auth_mode = %d auth_passwd = %s \n", __func__, idx, param.auth.auth, param.auth.passwd);
strncpy(auth_passwd, param.auth.passwd, sizeof(param.auth.passwd) - 1);
- lynq_wifi_auth_e type;
- switch (param.auth.auth)
- {
- case SC_WIFI_AUTH_OPEN:
- type = LYNQ_WIFI_AUTH_OPEN;
- break;
- case SC_WIFI_AUTH_WPA2_PSK:
- type = LYNQ_WIFI_AUTH_WPA2_PSK;
- break;
- case SC_WIFI_AUTH_WPA_WPA2_PSK_BOTH:
- type = LYNQ_WIFI_AUTH_WPA_WPA2_PSK_BOTH;
- break;
- case SC_WIFI_AUTH_WPA3_PSK:
- type = LYNQ_WIFI_AUTH_WPA3_PSK;
- break;
- case SC_WIFI_AUTH_WPA2_WPA3_PSK_BOTH:
- type = LYNQ_WIFI_AUTH_WPA2_WPA3_PSK_BOTH;
- break;
- default:
- type = LYNQ_WIFI_AUTH_MIN;
- break;
- }
- *auth_mode = type;
+
+ *auth_mode = sc_to_lynq_auth_mode(param.auth.auth);
return 0;
}
@@ -516,19 +795,131 @@
ret = sc_wifi_ap_stop((sc_wifi_ap_index_e)idx);
if (0 != ret)
{
- LYERRLOG("[%s ] stop: %d ret = %d\n", __func__,ret);
+ LYERRLOG("[%s ] stop ret = %d\n", __func__,ret);
return ret;
}
ret = sc_wifi_ap_start((sc_wifi_ap_index_e)idx);
if (0 != ret)
{
- LYERRLOG("[%s ] start: %d ret = %d\n", __func__,ret);
+ LYERRLOG("[%s ] start ret = %d\n", __func__,ret);
return ret;
}
LYINFLOG("[%s ] idx = %d \n", __func__, idx);
return 0;
}
+/********************************************************************
+* @brief: qser_wifi_sta_param_set, Set the ssid and password that you need to connect to the access point
+* @param lynq_stat [IN]: sc_wifi_sta_param_t *, Set parameters such as ssid and password that you want to connect to the access point
+* @return : int, If equal to 0 succeeds, others fail
+* @todo: NA
+* @see: NA
+* @warning: NA
+*********************************************************************/
+int qser_wifi_sta_param_set(lynq_wifi_sta_param_t *lynq_stat)
+{
+ int ret = -1;
+ sc_wifi_sta_param_t stat = {0};
+ stat.auth = lynq_to_sc_auth_mode(lynq_stat->auth);
+ stat.pairwise = (sc_wifi_auth_wpa_psk_e )lynq_stat->pairwise;
+ strncpy(stat.ssid, lynq_stat->ssid, sizeof(stat.ssid));
+ strncpy(stat.passwd, lynq_stat->passwd, sizeof(stat.passwd));
+ ret = sc_wifi_sta_param_set(&stat);
+ if (0 != ret)
+ {
+ LYERRLOG("[%s ] sta_param_set ret = %d\n", __func__,ret);
+ return ret;
+ }
+ LYINFLOG("[%s ] ret = %d \n", __func__, ret);
+ return 0;
+}
+
+/********************************************************************
+* @brief: qser_wifi_sta_param_get, Get the ssid and password that you need to connect to the access point
+* @param lynq_stat [OUT]: sc_wifi_sta_param_t *, Get parameters such as ssid and password that you want to connect to the access point
+* @return : int, If equal to 0 succeeds, others fail
+* @todo: NA
+* @see: NA
+* @warning: NA
+*********************************************************************/
+int qser_wifi_sta_param_get(lynq_wifi_sta_param_t *lynq_stat)
+{
+ int ret = -1;
+ sc_wifi_sta_param_t stat = {0};
+ ret = sc_wifi_sta_param_get(&stat);
+ if (0 != ret)
+ {
+ LYERRLOG("[%s ] sta_param_get ret = %d\n", __func__,ret);
+ return ret;
+ }
+ lynq_stat->auth = sc_to_lynq_auth_mode(stat.auth);
+ lynq_stat->pairwise = (lynq_wifi_auth_wpa_psk_e )stat.pairwise;
+ strncpy(lynq_stat->ssid, stat.ssid, sizeof(stat.ssid));
+ strncpy(lynq_stat->passwd, stat.passwd, sizeof(stat.passwd));
+ LYINFLOG("[%s ] ret = %d \n", __func__, ret);
+ return 0;
+}
+
+/********************************************************************
+* @brief: qser_wifi_sta_start_scan, Scan for ap nodes and return them through callback
+* @return : int, If equal to 0 succeeds, others fail
+* @todo: NA
+* @see: NA
+* @warning: NA
+*********************************************************************/
+int qser_wifi_sta_start_scan(void)
+{
+ int ret = -1;
+ ret = sc_wifi_sta_start_scan();
+ if (0 != ret)
+ {
+ LYERRLOG("[%s ] scan ret = %d\n", __func__,ret);
+ return ret;
+ }
+ LYINFLOG("[%s ] ret = %d \n", __func__, ret);
+ return 0;
+}
+
+/********************************************************************
+* @brief: qser_wifi_sta_start, To enable sta mode, you need to enable ap mode first
+* @return : int, If equal to 0 succeeds, others fail
+* @todo: NA
+* @see: NA
+* @warning: NA
+*********************************************************************/
+int qser_wifi_sta_start(void)
+{
+ int ret = -1;
+ ret = sc_wifi_sta_start();
+ if (0 != ret)
+ {
+ LYERRLOG("[%s ] sta_start ret = %d\n", __func__,ret);
+ return ret;
+ }
+ LYINFLOG("[%s ] ret = %d \n", __func__, ret);
+ return 0;
+}
+
+/********************************************************************
+* @brief: qser_wifi_sta_stop, To disable sta mode.
+* @return : int, If equal to 0 succeeds, others fail
+* @todo: NA
+* @see: NA
+* @warning: NA
+*********************************************************************/
+int qser_wifi_sta_stop(void)
+{
+ int ret = -1;
+ ret = sc_wifi_sta_stop();
+ if (0 != ret)
+ {
+ LYERRLOG("[%s ] sta_stop ret = %d\n", __func__,ret);
+ return ret;
+ }
+ LYINFLOG("[%s ] ret = %d \n", __func__, ret);
+ return 0;
+}
+
DEFINE_LYNQ_LIB_LOG(LYNQ_WIFI)
#ifdef __cplusplus
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-uci/lynq_uci.config b/cap/zx297520v3/src/lynq/lib/liblynq-uci/lynq_uci.config
index 7193768..c08d25b 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-uci/lynq_uci.config
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-uci/lynq_uci.config
@@ -14,7 +14,7 @@
config lynq_autosuspend 'lynq_autosuspend'
option auto_enable '0'
option debug '1'
- option whitelist_state '0000'
+ option whitelist_state '1011'
config debug_mode 'debug_mode'
option sysinfo_debug_status '1'
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/arch/arm/boot/dts/zx297520v3-vehicle_dc_ref.dts b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/arch/arm/boot/dts/zx297520v3-vehicle_dc_ref.dts
index b9638e6..4f4e580 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/arch/arm/boot/dts/zx297520v3-vehicle_dc_ref.dts
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/arch/arm/boot/dts/zx297520v3-vehicle_dc_ref.dts
@@ -164,9 +164,11 @@
&gmac {
port-nums = <1>;
rmii-ports = <1>;
-
+//zw.wang phy driver support for Marvell_88q1110 on 20240417 start
gpios = <&bgpio 83 GPIO_ACTIVE_HIGH>,
- <&bgpio 63 GPIO_ACTIVE_HIGH>;
+ <&bgpio 63 GPIO_ACTIVE_HIGH>,
+ <&bgpio 51 GPIO_ACTIVE_HIGH>;
+//zw.wang phy driver support for Marvell_88q1110 on 20240417 end
status = "okay";
};
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/arch/arm/boot/dts/zx297520v3.dtsi b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/arch/arm/boot/dts/zx297520v3.dtsi
index d441a1a..92e4177 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/arch/arm/boot/dts/zx297520v3.dtsi
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/arch/arm/boot/dts/zx297520v3.dtsi
@@ -486,17 +486,19 @@
status = "disabled";
};
codec_ti3104: ti3104@18 {
+ //yu.dong@20240416[T106BUG-582]Modify codec to play recording without sound start
compatible = "ti,tlv320aic3104";
- reg = <0x18>;
- reset-gpios = <&bgpio 122 GPIO_ACTIVE_HIGH>;/*RST*/
+ reg = <0x18>;
+ //reset-gpios = <&bgpio 122 GPIO_ACTIVE_HIGH>;/*RST*/
ai3x-micbias-vg = <MICBIAS_2_0V>;
- clocks = <&clkc CLKOUT1_CLK>;
- clock-names = "clk_out";
- pinctrl-names = "clk_out","reset_gpio122";
- pinctrl-0 = <&clk1_func_pins>;
+ clocks = <&clkc CLKOUT2_CLK>;
+ clock-names = "clk_out";
+ pinctrl-names = "clk_out","reset_gpio122";
+ pinctrl-0 = <&clk2_func_pins>;
pinctrl-1 = <&codec_reset_pins>;
status = "disabled";
+ //yu.dong@20240416[T106BUG-582]Modify codec to play recording without sound end
};
codec_max9867: max9867@18 {
compatible = "maxim,max9867";
@@ -527,10 +529,12 @@
interrupts = <GIC_SPI GMAC_INT IRQ_TYPE_LEVEL_HIGH>;
phy-mode = "rmii";
port-mask = <0x00000000>;
- pinctrl-names = "default", "sleep";
+ //zw.wang phy driver support for Marvell_88q1110 on 20240417 start
+ pinctrl-names = "default", "sleep", "state0";
pinctrl-0 = <&rmii_active>;
pinctrl-1 = <&rmii_sleep>;
-
+ pinctrl-2 = <&rmii_clki_pins>;
+ //zw.wang phy driver support for Marvell_88q1110 on 20240417 end
status = "disabled";
};
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/ethernet/zte/zx29_gmac.c b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/ethernet/zte/zx29_gmac.c
old mode 100755
new mode 100644
index 9312efe..5dc69f5
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/ethernet/zte/zx29_gmac.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/ethernet/zte/zx29_gmac.c
@@ -491,33 +491,33 @@
struct mdio_device *mdio_dev = NULL;
int ret = 0;
- //zw.wang Without phy, gmac's gpio output power is removed on 20240328 start
- int i = 0;
- for(i = 0;i <= 5;i++)
- {
- if (priv->nports == 1) {
- p = phy_find_first(priv->mii.bus);
- } else if (priv->rmii_port < PHY_MAX_ADDR) {
- mdio_dev = priv->mii.bus->mdio_map[priv->rmii_port];
- p = container_of(mdio_dev, struct phy_device, mdio);
- }
-
- if (!p) {
- if(i == 5){
- gpio_direction_output(priv->gpio_power[0], 0);
-#ifdef CONFIG_MDIO_C45
- gpio_direction_output(priv->gpio_power[1], 0);
-#endif
- }
- else
- continue;
- printk("%s: no PHY found\n", dev->name);
- return -ENODEV;
- }
- else
- break;
- }
- //zw.wang Without phy, gmac's gpio output power is removed on 20240328 end
+ //zw.wang Without phy, gmac's gpio output power is removed on 20240328 start
+ int i = 0;
+ for(i = 0;i <= 5;i++)
+ {
+ if (priv->nports == 1) {
+ p = phy_find_first(priv->mii.bus);
+ } else if (priv->rmii_port < PHY_MAX_ADDR) {
+ mdio_dev = priv->mii.bus->mdio_map[priv->rmii_port];
+ p = container_of(mdio_dev, struct phy_device, mdio);
+ }
+
+ if (!p) {
+ if(i == 5){
+ gpio_direction_output(priv->gpio_power[0], 0);
+#ifdef CONFIG_MDIO_C45
+ gpio_direction_output(priv->gpio_power[1], 0);
+#endif
+ }
+ else
+ continue;
+ printk("%s: no PHY found\n", dev->name);
+ return -ENODEV;
+ }
+ else
+ break;
+ }
+ //zw.wang Without phy, gmac's gpio output power is removed on 20240328 end
ret = phy_connect_direct(dev, p, zx29_gmac_adjust_link, PHY_INTERFACE_MODE_RMII); /* phy_start_machine */
/* supported and advertising */
@@ -879,8 +879,9 @@
static void zx29_gmac_tx_timeout(struct net_device *ndev, unsigned int txqueue)
{
struct zx29_gmac_dev *priv = (struct zx29_gmac_dev *)netdev_priv(ndev);
-
-// genphy_update_link(priv->phydev);
+#ifdef CONFIG_MARVELL_88Q1110 //zw.wang phy driver support for Marvell_88q1110 on 20240417
+ genphy_update_link(priv->phydev);
+#endif
priv->link.isup = priv->phydev->link;
if (0 == priv->link.isup) {
@@ -1159,16 +1160,21 @@
#endif
printk("[%s] netif_running\n", __func__);
-
-
+#ifdef CONFIG_MARVELL_88Q1110 //zw.wang phy driver support for Marvell_88q1110 on 20240417
+ gpio_direction_output(priv->gpio_power[0], 0);
+ gmac_stop((void*)ndev->base_addr);
+#else
gmac_stop((void*)ndev->base_addr);
gpio_direction_output(priv->gpio_power[0], 0);
+#endif
spin_unlock_irqrestore(&priv->lock, flag);
#endif
}
}
+#ifndef CONFIG_MARVELL_88Q1110 //zw.wang phy driver support for Marvell_88q1110 on 20240417
pinctrl_pm_select_sleep_state(&pdev->dev);
+#endif
return 0;
}
@@ -1182,8 +1188,10 @@
void __iomem *base = NULL;
gmac = (unsigned *)ndev->base_addr;
unsigned long flag = 0;
-
+
+#ifndef CONFIG_MARVELL_88Q1110 //zw.wang phy driver support for Marvell_88q1110 on 20240417
pinctrl_pm_select_default_state(&pdev->dev);
+#endif
if(ndev) {
if(netif_running(ndev)) {
// gmac_start((void*)ndev->base_addr);
@@ -1757,8 +1765,12 @@
pctrl = NULL;
goto errirq;
}
-
+
+#ifdef CONFIG_MARVELL_88Q1110 //zw.wang phy driver support for Marvell_88q1110 on 20240417
+ state0 = pinctrl_lookup_state(pctrl, "state0");
+#else
state0 = pinctrl_lookup_state(pctrl, "default");
+#endif
if (IS_ERR(state0)) {
dev_err(&pdev->dev, "TEST: missing state0\n");
goto pinctrl_init_end;
@@ -1768,7 +1780,14 @@
dev_err(&pdev->dev, "setting state0 failed\n");
goto pinctrl_init_end;
}
-
+
+#ifdef CONFIG_MARVELL_88Q1110 //zw.wang phy driver support for Marvell_88q1110 on 20240417
+ prv->gpio_power[2] = of_get_gpio_flags(pdev->dev.of_node, 2, &flags);
+ ret = gpio_request(prv->gpio_power[2], "phy_power"); /* gpio 51 */
+ gpio_direction_output(prv->gpio_power[2], 1);
+ mdelay(15);
+#endif
+
prv->gpio_power[0] = of_get_gpio_flags(pdev->dev.of_node, 0, &flags);
ret = gpio_request(prv->gpio_power[0], "gmac_power"); /* gpio 83/124 */
gpio_direction_output(prv->gpio_power[0], 1);
@@ -1861,7 +1880,11 @@
base = devm_platform_ioremap_resource(pdev, 1);
gmac_phy_release();
base_phy_release = base;
+#ifdef CONFIG_MARVELL_88Q1110 //zw.wang phy driver support for Marvell_88q1110 on 20240417
+ mdelay(500);
+#else
mdelay(10); //zw.wang@20240306 modify. Here, the jl3103 is set as an example, and other phy peripherals need to be optimized according to different reset stability times
+#endif
ret = mdiobus_register(mb);
if (ret < 0) {
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/ethernet/zte/zx29_gmac.h b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/ethernet/zte/zx29_gmac.h
index 46a87d3..d2abe1e 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/ethernet/zte/zx29_gmac.h
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/ethernet/zte/zx29_gmac.h
@@ -11,7 +11,11 @@
#ifndef __ZX29_GMAC_
#define __ZX29_GMAC_
-//#define GMAC_NO_INT
+//zw.wang phy driver support for Marvell_88q1110 on 20240417 start
+#ifdef CONFIG_MARVELL_88Q1110
+#define GMAC_NO_INT
+#endif
+//zw.wang phy driver support for Marvell_88q1110 on 20240417 end
#ifdef GMAC_NO_INT
#define GTIMER_INTERVAL 2000
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/phy/Kconfig b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/phy/Kconfig
index a0bf99d..7795b72 100644
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/phy/Kconfig
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/phy/Kconfig
@@ -321,6 +321,14 @@
help
It is disabled by default. The value is C45 if yes, and C22 if N.
# zw.wang Customer chooses phy c22/c45 issues on 20240301 end
+
+# zw.wang phy driver support for Marvell_88q1110 on 20240417 start
+config MARVELL_88Q1110
+ bool "phy driver support for Marvell_88q1110"
+ default n
+ help
+ Phy driver support for Marvell_88q1110.
+# zw.wang phy driver support for Marvell_88q1110 on 20240417 end
endif # PHYLIB
config MICREL_KS8995MA
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/phy/phy_device.c b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/phy/phy_device.c
index a868814..d9b53ba 100644
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/phy/phy_device.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/phy/phy_device.c
@@ -120,6 +120,19 @@
ETHTOOL_LINK_MODE_10000baseT_Full_BIT,
};
+//status = phy_read_cl(phydev, MII_BMSR);
+static int phy_read_cl(struct phy_device *phydev, u32 regnum)
+{
+ int val = 0;
+
+ mdiobus_write(phydev->mdio.bus, phydev->mdio.addr, 0x0d, 1);
+ mdiobus_write(phydev->mdio.bus, phydev->mdio.addr, 0x0e, regnum);
+ mdiobus_write(phydev->mdio.bus, phydev->mdio.addr, 0x0d, 0x4000 | 1);
+ val = mdiobus_read(phydev->mdio.bus, phydev->mdio.addr, 0x0e);
+
+ return val;
+}
+
static void features_init(void)
{
/* 10/100 half/full*/
@@ -2212,8 +2225,11 @@
int genphy_update_link(struct phy_device *phydev)
{
int status = 0, bmcr;
-
+#ifdef CONFIG_MARVELL_88Q1110 //zw.wang phy driver support for Marvell_88q1110 on 20240417
+ bmcr = phy_read_cl(phydev, MII_BMCR);
+#else
bmcr = phy_read(phydev, MII_BMCR);
+#endif
if (bmcr < 0)
return bmcr;
@@ -2229,7 +2245,11 @@
* the link was already down.
*/
if (!phy_polling_mode(phydev) || !phydev->link) {
+#ifdef CONFIG_MARVELL_88Q1110 //zw.wang phy driver support for Marvell_88q1110 on 20240417
+ status = phy_read_cl(phydev, MII_BMSR);
+#else
status = phy_read(phydev, MII_BMSR);
+#endif
if (status < 0)
return status;
else if (status & BMSR_LSTATUS)
@@ -2237,7 +2257,11 @@
}
/* Read link and autonegotiation status */
+#ifdef CONFIG_MARVELL_88Q1110 //zw.wang phy driver support for Marvell_88q1110 on 20240417
+ status = phy_read_cl(phydev, MII_BMSR);
+#else
status = phy_read(phydev, MII_BMSR);
+#endif
if (status < 0)
return status;
done:
@@ -2310,7 +2334,11 @@
*/
int genphy_read_status_fixed(struct phy_device *phydev)
{
+#ifdef CONFIG_MARVELL_88Q1110 //zw.wang phy driver support for Marvell_88q1110 on 20240417
+ int bmcr = phy_read_cl(phydev, MII_BMCR);
+#else
int bmcr = phy_read(phydev, MII_BMCR);
+#endif
if (bmcr < 0)
return bmcr;
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/soc/sc/power_4line/hal_xp2xp.c b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/soc/sc/power_4line/hal_xp2xp.c
index f2f7cb8..c0b745f 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/soc/sc/power_4line/hal_xp2xp.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/soc/sc/power_4line/hal_xp2xp.c
@@ -343,10 +343,7 @@
/*jb.qi add for dtr uevent on 20231218 start*/
static int xp2xp_wkcp_thread(void *ptr)
{
- int call_state = 0;
- int v_gpio = 0;
int ret = 0;
- unsigned long flags;
struct hal_xp2xp_dev *xp2xp_dev = (struct hal_xp2xp_dev *)ptr;
while(!kthread_should_stop()){
@@ -362,23 +359,9 @@
}
}
- spin_lock_irqsave(&xp2xp_dev->wk_lock, flags);
- if(xp2xp_dev->wake_state){
- spin_unlock_irqrestore(&xp2xp_dev->wk_lock, flags);
- xp2xp_notify_up(WAKEUP_NOTIFY);
- xp2xp_dev->wake_cnt++;
-#ifdef CONFIG_KERNEL_CONTROL_WAKEUP
- xp2xp_wakeup_notifier_call_chain(WAKEUP_NOTIFY, &call_state);
-#endif
- }else{
- spin_unlock_irqrestore(&xp2xp_dev->wk_lock, flags);
- xp2xp_notify_up(SLEEP_NOTIFY);
- xp2xp_dev->sleep_cnt++;
-#ifdef CONFIG_KERNEL_CONTROL_WAKEUP
- xp2xp_wakeup_notifier_call_chain(SLEEP_NOTIFY, &call_state);
-#endif
- }
-
+ msleep(40);
+ wakeup_irq_occurs = 1;
+ wake_up_interruptible(&wakeup_dtr_wqhead);
enable_irq(xp2xp_dev->eint_irq);
xp2xp_dev->xp2xp_irq_state = 1;
@@ -409,6 +392,7 @@
struct hal_xp2xp_dev *xp2xp_dev = (struct hal_xp2xp_dev *)priv;
disable_irq_nosync(irq);/*jb.qi add for dtr on 20240202*/
+ xp2xp_dev->xp2xp_irq_state = 0;
gpio_value = 0 ;
if(xp2xp_dev->xp2xp_ws){
@@ -440,11 +424,7 @@
printk( "setting card detect irq failed\n");
}
irq_set_irq_type(irq,irq_type);
- /*jb.qi add for dtr on 20240202 start*/
- wakeup_irq_occurs = 1;
- wake_up_interruptible(&wakeup_dtr_wqhead);
- enable_irq(xp2xp_dev->eint_irq);
- /*jb.qi add for dtr on 20240202 end*/
+ up(&xp2xp_dev->wk_sem);
return IRQ_HANDLED;
}
/*jb.qi add for dtr uevent on 20231218 end*/
@@ -803,14 +783,13 @@
panic("hal_xp2xp_probe request_irq fail, %d", ret);
}
- /*jb.qi add for dtr on 20240202 start
g_xp2xp.wake_int_thread = kthread_run(xp2xp_wkcp_thread, (void *)&g_xp2xp, "xp2xp_wake_thread");
if (IS_ERR(g_xp2xp.wake_int_thread)) {
printk("Can't start up our thread");
return PTR_ERR(g_xp2xp.wake_int_thread);
- }
- */
+ }
+
enable_irq_wake(g_xp2xp.eint_irq);
/*jb.q add for dtr on 20231204 start*/
/* gpio request */
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/sound/soc/codecs/es8311.c b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/sound/soc/codecs/es8311.c
index 1bc3004..899ab9c 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/sound/soc/codecs/es8311.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/sound/soc/codecs/es8311.c
@@ -1044,73 +1044,8 @@
static int es8311_resume(struct snd_soc_component *component)
{
- struct es8311_private *es8311 = snd_soc_component_get_drvdata(component);
-
printk("Enter into %s()\n", __func__);
- snd_soc_component_write(component, ES8311_GP_REG45, 0x00);
- snd_soc_component_write(component, ES8311_CLK_MANAGER_REG01, 0x30);
- snd_soc_component_write(component, ES8311_CLK_MANAGER_REG02, 0x00);
- snd_soc_component_write(component, ES8311_CLK_MANAGER_REG03, 0x10);
- snd_soc_component_write(component, ES8311_ADC_REG16, 0x24);
- snd_soc_component_write(component, ES8311_CLK_MANAGER_REG04, 0x10);
- snd_soc_component_write(component, ES8311_CLK_MANAGER_REG05, 0x00);
- snd_soc_component_write(component, ES8311_SDPIN_REG09, 0x00);
- snd_soc_component_write(component, ES8311_SDPOUT_REG0A, 0x00);
- snd_soc_component_write(component, ES8311_SYSTEM_REG0B, 0x00);
- snd_soc_component_write(component, ES8311_SYSTEM_REG0C, 0x00);
-
- if (ES8311_AVDD == ES8311_1V8) {
- snd_soc_component_write(component, ES8311_SYSTEM_REG10, 0x61);
- snd_soc_component_write(component, ES8311_SYSTEM_REG11, 0x7B);
- } else {
- snd_soc_component_write(component, ES8311_SYSTEM_REG10, 0x03);
- snd_soc_component_write(component, ES8311_SYSTEM_REG11, 0x57);
- }
- if (es8311->mclk_src == ES8311_MCLK_PIN) {
- snd_soc_component_write(component, ES8311_CLK_MANAGER_REG01, 0x3F);
- snd_soc_component_write(component, ES8311_CLK_MANAGER_REG01, 0xBF);
- }
- if (es8311->mastermode == 1)
- snd_soc_component_write(component, ES8311_RESET_REG00, 0xC0);
- else
- snd_soc_component_write(component, ES8311_RESET_REG00, 0x80);
-
- usleep_range(1500, 3000);
- snd_soc_component_write(component, ES8311_SYSTEM_REG0D, 0x01);
-
- if (es8311->mclkinv == true) {
- snd_soc_component_update_bits(component, ES8311_CLK_MANAGER_REG01,
- 0x40, 0x40);
- } else {
- snd_soc_component_update_bits(component, ES8311_CLK_MANAGER_REG01,
- 0x40, 0x00);
- }
- if (es8311->sclkinv == true) {
- snd_soc_component_update_bits(component, ES8311_CLK_MANAGER_REG06,
- 0x20, 0x20);
- } else {
- snd_soc_component_update_bits(component, ES8311_CLK_MANAGER_REG06,
- 0x20, 0x00);
- }
- snd_soc_component_write(component, ES8311_SYSTEM_REG14, 0x1A);
- if (es8311->dmic_enable == true) {
- snd_soc_component_update_bits(component, ES8311_SYSTEM_REG14,
- 0x40, 0x40);
- } else {
- snd_soc_component_update_bits(component, ES8311_SYSTEM_REG14,
- 0x40, 0x00);
- }
- snd_soc_component_write(component, ES8311_SYSTEM_REG12, 0x00);
- snd_soc_component_write(component, ES8311_SYSTEM_REG13, 0x10);
- snd_soc_component_write(component, ES8311_SYSTEM_REG0E, 0x02);
- snd_soc_component_write(component, ES8311_SYSTEM_REG0F, 0x7F);
- snd_soc_component_write(component, ES8311_ADC_REG15, 0x40);
- snd_soc_component_write(component, ES8311_ADC_REG1B, 0x0A);
- snd_soc_component_write(component, ES8311_ADC_REG1C, 0x6A);
- snd_soc_component_write(component, ES8311_DAC_REG37, 0x48);
- snd_soc_component_write(component, ES8311_ADC_REG17, 0xBF);
- snd_soc_component_write(component, ES8311_DAC_REG32, 0xBF);
-
+ //yu.dong@20240416[ZXW-268]Added codec re-initialization for power down and I2S default configuration adjustment
return 0;
}
@@ -1251,19 +1186,9 @@
unsigned tmp;
printk("Enter into %s()\n", __func__);
-
-
- #if 1
- void __iomem *reg_base;
- reg_base = ioremap(0x13B000+0x94 ,4);
- tmp = ioread32(reg_base);
- tmp |= (1<<0)|(1<<2);
- iowrite32(tmp,reg_base);
-
-
- #endif
-
-
+
+ //yu.dong@20240416[T106BUG-551][codec] codec 8311 sleep power consumption does not go down
+
dev_info(dev, "%s:start!\n", __func__);
if(dev == NULL){
@@ -1357,6 +1282,91 @@
}
+//yu.dong@20240416[ZXW-268]Added codec re-initialization for power down and I2S default configuration adjustment start
+static void es8311_reinit(struct snd_soc_component *component, struct es8311_private *es8311)
+{
+ pr_info("%s:begin!\n", __func__);
+
+ snd_soc_component_write(component, ES8311_GP_REG45, 0x00);
+ snd_soc_component_write(component, ES8311_CLK_MANAGER_REG01, 0x30);
+ snd_soc_component_write(component, ES8311_CLK_MANAGER_REG02, 0x00);
+ snd_soc_component_write(component, ES8311_CLK_MANAGER_REG03, 0x10);
+ //snd_soc_component_write(component, ES8311_ADC_REG16, 0x24);
+ snd_soc_component_write(component, ES8311_ADC_REG16, 0x21);
+ snd_soc_component_write(component, ES8311_CLK_MANAGER_REG04, 0x10);
+ snd_soc_component_write(component, ES8311_CLK_MANAGER_REG05, 0x00);
+ snd_soc_component_write(component, ES8311_SDPIN_REG09, 0x00);
+ snd_soc_component_write(component, ES8311_SDPOUT_REG0A, 0x00);
+ snd_soc_component_write(component, ES8311_SYSTEM_REG0B, 0x00);
+ snd_soc_component_write(component, ES8311_SYSTEM_REG0C, 0x00);
+
+ if (ES8311_AVDD == ES8311_1V8) {
+ snd_soc_component_write(component, ES8311_SYSTEM_REG10, 0x61);
+ snd_soc_component_write(component, ES8311_SYSTEM_REG11, 0x7B);
+ } else {
+ snd_soc_component_write(component, ES8311_SYSTEM_REG10, 0x03);
+ snd_soc_component_write(component, ES8311_SYSTEM_REG11, 0x57);
+ }
+
+ if (es8311->mclk_src == ES8311_MCLK_PIN) {
+ snd_soc_component_write(component, ES8311_CLK_MANAGER_REG01, 0x3F);
+ } else {
+ snd_soc_component_write(component, ES8311_CLK_MANAGER_REG01, 0xBF);
+ }
+
+ if (es8311->mastermode == 1) {
+ snd_soc_component_write(component, ES8311_RESET_REG00, 0xC0);
+ } else {
+ snd_soc_component_write(component, ES8311_RESET_REG00, 0x80);
+ }
+
+ usleep_range(1500, 3000);
+ snd_soc_component_write(component, ES8311_SYSTEM_REG0D, 0x01);
+
+ if (es8311->mclkinv == true) {
+ snd_soc_component_update_bits(component, ES8311_CLK_MANAGER_REG01, 0x40, 0x40);
+ } else {
+ snd_soc_component_update_bits(component, ES8311_CLK_MANAGER_REG01, 0x40, 0x00);
+ }
+
+ if (es8311->sclkinv == true) {
+ snd_soc_component_update_bits(component, ES8311_CLK_MANAGER_REG06, 0x20, 0x20);
+ } else {
+ snd_soc_component_update_bits(component, ES8311_CLK_MANAGER_REG06, 0x20, 0x00);
+ }
+
+ snd_soc_component_write(component, ES8311_SYSTEM_REG14, 0x1A);
+
+ if (es8311->dmic_enable == true) {
+ snd_soc_component_update_bits(component, ES8311_SYSTEM_REG14, 0x40, 0x40);
+ } else {
+ snd_soc_component_update_bits(component, ES8311_SYSTEM_REG14, 0x40, 0x00);
+ }
+
+ snd_soc_component_write(component, ES8311_SYSTEM_REG12, 0x00);
+ snd_soc_component_write(component, ES8311_SYSTEM_REG13, 0x10);
+ snd_soc_component_write(component, ES8311_SYSTEM_REG0E, 0x02);
+ snd_soc_component_write(component, ES8311_SYSTEM_REG0F, 0x7F);
+ snd_soc_component_write(component, ES8311_ADC_REG15, 0x40);
+ snd_soc_component_write(component, ES8311_ADC_REG1B, 0x0A);
+ snd_soc_component_write(component, ES8311_ADC_REG1C, 0x6A);
+ snd_soc_component_write(component, ES8311_DAC_REG37, 0x48);
+ snd_soc_component_write(component, ES8311_ADC_REG17, 0xBF);
+ snd_soc_component_write(component, ES8311_DAC_REG32, 0xBF);
+ snd_soc_component_write(component, ES8311_CLK_MANAGER_REG02, 0x98);
+ snd_soc_component_write(component, ES8311_CLK_MANAGER_REG03, 0x1b);
+ snd_soc_component_write(component, ES8311_CLK_MANAGER_REG04, 0x1b);
+ snd_soc_component_write(component, ES8311_CLK_MANAGER_REG05, 0xbb);
+
+ msleep(100);
+ es8311_set_bias_level(component, SND_SOC_BIAS_STANDBY);
+
+ pr_info("%s:end!\n", __func__);
+}
+
+extern int zx29_i2s_config_sleep_pin(void);
+extern int zx29_i2s_config_default_pin(void);
+
static int component_open(struct snd_soc_component *component,
struct snd_pcm_substream *substream)
{
@@ -1373,6 +1383,12 @@
}
}
+ ret = zx29_i2s_config_default_pin();
+ if(ret < 0) {
+ pr_err("%s select state failure %d !! \n", __func__, ret);
+ }
+ es8311_reinit(component, info);
+
pr_info("%s:clk en end!\n",__func__);
return ret;
@@ -1396,13 +1412,19 @@
}
pr_info("%s:clk dis end!\n",__func__);
-
+
+ ret = zx29_i2s_config_sleep_pin();
+ if(ret < 0) {
+ pr_err("%s select state failure %d !! \n", __func__, ret);
+ }
+
return ret;
}
+//yu.dong@20240416[ZXW-268]Added codec re-initialization for power down and I2S default configuration adjustment end
static const struct snd_soc_component_driver soc_component_dev_es8311 = {
.probe = es8311_probe,
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/sound/soc/codecs/tlv320aic3x.c b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/sound/soc/codecs/tlv320aic3x.c
index 3690409..165d46d 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/sound/soc/codecs/tlv320aic3x.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/sound/soc/codecs/tlv320aic3x.c
@@ -1203,13 +1203,15 @@
regmap_read(info->regmap, AIC3X_PAGE_SELECT, &pre_page);
regmap_write(info->regmap, AIC3X_PAGE_SELECT, 0);
- for (i = regmin; i < regmax; i++) {
+ //yu.dong@20240416[T106BUG-582]Modify codec to play recording without sound start
+ for (i = regmin; i <= regmax; i++) {
//val = snd_soc_component_read(info->component, i);
regmap_read(info->regmap, i, &val);
dev_info(dev,"cocec reg read ,Reg(%d)=0x%x \n",i, val);
}
+ //yu.dong@20240416[T106BUG-582]Modify codec to play recording without sound end
regmap_write(info->regmap, AIC3X_PAGE_SELECT, pre_page);
return count;
@@ -1255,23 +1257,18 @@
dev_info(dev, "%s:cmd_str=%s \n",__func__,cmd_str);
-
ret = strcmp(cmd_str,"reg_read");
if( ret == 0)
{
dev_info(dev, "reg_read start\n");
- if(param1 > 1){
- dev_err(dev, "reg_read param invalidate fail,param1=%d \n",param1);
- return -1;
- }
- regpage = param1;
- if(param2 > regmax){
- dev_err(dev, "reg_read param invalidate fail,param2=%d \n",param2);
- return -1;
- }
-
-
+ //yu.dong@20240416[T106BUG-582]Modify codec to play recording without sound start
+ if(param1 < 0 || param1 > 109){
+ dev_err(dev, "reg_read param invalidate fail,param1=%d \n",param1);
+ return -1;
+ }
+ //yu.dong@20240416[T106BUG-582]Modify codec to play recording without sound end
+
regmap_read(info->regmap, AIC3X_PAGE_SELECT, &pre_page);
regmap_write(info->regmap, AIC3X_PAGE_SELECT, regpage);
@@ -1295,17 +1292,14 @@
//u32 offset = param1;
//u32 mask = param2;
dev_info(dev, "reg_write start\n");
- if(param1 > 1){
- dev_err(dev, "reg_write param invalidate fail,param1=%d \n",param1);
- return -1;
- }
- regpage = param1;
- if(param2 > regmax){
- dev_err(dev, "reg_write param invalidate fail,param1=%d \n",param1);
- return -1;
- }
-
+ //yu.dong@20240416[T106BUG-582]Modify codec to play recording without sound start
+ if(param1 < 0 || param1 > 109){
+ dev_err(dev, "reg_write param invalidate fail,param1=%d \n",param1);
+ return -1;
+ }
+ //yu.dong@20240416[T106BUG-582]Modify codec to play recording without sound end
+
regmap_read(info->regmap, AIC3X_PAGE_SELECT, &pre_page);
regmap_write(info->regmap, AIC3X_PAGE_SELECT, regpage);
@@ -1842,23 +1836,25 @@
.no_capture_mute = 1,
};
+//yu.dong@20240416[T106BUG-582]Modify codec to play recording without sound start
static struct snd_soc_dai_driver aic3x_dai = {
.name = "tlv320aic3x-hifi",
.playback = {
.stream_name = "Playback",
- .channels_min = 2,
+ .channels_min = 1,
.channels_max = 2,
.rates = AIC3X_RATES,
.formats = AIC3X_FORMATS,},
.capture = {
.stream_name = "Capture",
- .channels_min = 2,
+ .channels_min = 1,
.channels_max = 2,
.rates = AIC3X_RATES,
.formats = AIC3X_FORMATS,},
.ops = &aic3x_dai_ops,
.symmetric_rates = 1,
};
+//yu.dong@20240416[T106BUG-582]Modify codec to play recording without sound end
static void aic3x_mono_init(struct snd_soc_component *component)
{
@@ -2045,6 +2041,40 @@
return 0;
}
+//yu.dong@20240416[T106BUG-582]Modify codec to play recording without sound start
+static int component_open(struct snd_soc_component *component,
+ struct snd_pcm_substream *substream)
+{
+ int ret = 0;
+ struct aic3x_priv *info = snd_soc_component_get_drvdata(component);
+ printk("Enter into %s()\n", __func__);
+
+ if(info->clk != NULL) {
+ ret = clk_enable(info->clk);
+ if(ret) {
+ pr_err("failed to enable clkout");
+ }
+ }
+ pr_info("%s:clk en end!\n", __func__);
+
+ return ret;
+}
+
+static int component_close(struct snd_soc_component *component,
+ struct snd_pcm_substream *substream)
+{
+ int ret = 0;
+ struct aic3x_priv *info = snd_soc_component_get_drvdata(component);
+ printk("Enter into %s()\n", __func__);
+
+ if(info->clk != NULL) {
+ clk_disable(info->clk);
+ }
+ pr_info("%s:clk dis end!\n", __func__);
+
+ return ret;
+}
+
static const struct snd_soc_component_driver soc_component_dev_aic3x = {
.set_bias_level = aic3x_set_bias_level,
.probe = aic3x_probe,
@@ -2057,7 +2087,10 @@
.use_pmdown_time = 1,
.endianness = 1,
.non_legacy_dai_naming = 1,
+ .open = component_open,
+ .close = component_close,
};
+//yu.dong@20240416[T106BUG-582]Modify codec to play recording without sound end
static void aic3x_configure_ocmv(struct i2c_client *client)
{
@@ -2252,7 +2285,6 @@
#endif
-
pr_info( "alsa %s:end\n",__func__);
return 0;
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/sound/soc/sanechips/zx29_es83xx.c b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/sound/soc/sanechips/zx29_es83xx.c
index e059a8d..4e56af4 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/sound/soc/sanechips/zx29_es83xx.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/sound/soc/sanechips/zx29_es83xx.c
@@ -851,8 +851,8 @@
info->s = s;
info->s_sleep = s_sleep;
}
-
- ret = pinctrl_select_state(p, s);
+//yu.dong@20240416[ZXW-268]Added codec re-initialization for power down and I2S default configuration adjustment start
+ ret = pinctrl_select_state(p, s_sleep);
if (ret < 0) {
devm_pinctrl_put(p);
dev_err(dev, " select state failure!!\n");
@@ -862,6 +862,38 @@
}
+int zx29_i2s_config_default_pin(void)
+{
+ struct zx29_board_data *info = s_board;
+ int ret;
+
+ if (!info || !info->p || !info->s)
+ return -ENODEV;
+
+ ret = pinctrl_select_state(info->p, info->s);
+ if (ret < 0) {
+ pr_err(" %s select state failure %d!!\n", __func__, ret);
+ }
+
+ return ret;
+}
+
+int zx29_i2s_config_sleep_pin(void)
+{
+ struct zx29_board_data *info = s_board;
+ int ret;
+
+ if (!info || !info->p || !info->s_sleep)
+ return -ENODEV;
+
+ ret = pinctrl_select_state(info->p, info->s_sleep);
+ if (ret < 0) {
+ pr_err(" %s select state failure %d!!\n", __func__, ret);
+ }
+
+ return ret;
+}
+//yu.dong@20240416[ZXW-268]Added codec re-initialization for power down and I2S default configuration adjustment end
static int zx29_audio_probe(struct platform_device *pdev)
{
diff --git a/update_version.sh b/update_version.sh
index 21b5761..62bed82 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.02P56U01.AP.12.08"
-LYNQ_CAP_INSIDE_VERSION="CAP.12.08"
-LYNQ_CAP_VERSION="CAP.12.08"
+LYNQ_AP_VERSION="T106-V2.01.01.02P56U03.AP.13.02"
+LYNQ_CAP_INSIDE_VERSION="CAP.13.02"
+LYNQ_CAP_VERSION="CAP.13.02"
COMMIT_ID="$(git rev-parse HEAD)"
LYNQ_SW_INSIDE_VERSION="LYNQ_CONFIG_VERSION = \"${LYNQ_AP_VERSION}_${LYNQ_CAP_INSIDE_VERSION}\""