[Feature][T106_eSDK]update from T106-V2.01.01.02P56U09.AP.17.09_CAP.17.09.01 to T106-M42-PLXXXX-P56U11.AP.19.00_CAP.19.00.01 -- code
Only Configure: No
Affected branch: master
Affected module: unknow
Is it affected on both ZXIC and MTK: only ZXIC
Self-test: Yes
Doc Update: No
Change-Id: I5eb7f586f78a987785b0f9885f1300c42bfd6819
diff --git a/upstream/linux-5.10/drivers/mfd/zx234290-core.c b/upstream/linux-5.10/drivers/mfd/zx234290-core.c
index d43085f..6da76d2 100755
--- a/upstream/linux-5.10/drivers/mfd/zx234290-core.c
+++ b/upstream/linux-5.10/drivers/mfd/zx234290-core.c
@@ -246,15 +246,16 @@
#endif
#if 1
extern int Zx234290_SetUserReg_PSM(unsigned char data);
+extern void zxic_reset_reason(int reason, const char *cpu, const char *app);
void zx29_restart(const char * cmd)
{
/*set reset value = 1*/
- unsigned char status = ZX234290_USER_RST_TO_NORMAL;
+ unsigned char status = USER_RST_TO_NORMAL;
printk(KERN_INFO"restart:enter reboot :reset to normal\n");
+ zxic_reset_reason(2, "cap", current->comm);
- status = ZX234290_USER_RST_TO_NORMAL;
Zx234290_SetUserReg_PSM(status);
}
diff --git a/upstream/linux-5.10/drivers/mmc/core/mmc_ramdump.c b/upstream/linux-5.10/drivers/mmc/core/mmc_ramdump.c
index be7309c..9235ec4 100755
--- a/upstream/linux-5.10/drivers/mmc/core/mmc_ramdump.c
+++ b/upstream/linux-5.10/drivers/mmc/core/mmc_ramdump.c
@@ -530,7 +530,7 @@
}
//ÉèÖöÁÊý¾Ý´óС
-int mmc_bread(u32 start_addr, u32 data_size, void *dst)
+int mmc_bread(u64 start_addr, u32 data_size, void *dst)
{
int ret;
u32 src = 0;
@@ -548,7 +548,7 @@
if(block_addr == 0)
src = start_addr;
else
- src = start_addr/MMC_BLOCK_SIZE;
+ src = (u32)(start_addr/MMC_BLOCK_SIZE);
if(blk_count){
ret= zx_mmc_read(src, (u8 *) dst, blk_count * MMC_BLOCK_SIZE);
@@ -573,7 +573,7 @@
return data_size;
}
-int mmc_bwrite(u32 start_addr, u32 data_size, void *src_buf)
+int mmc_bwrite(u64 start_addr, u32 data_size, void *src_buf)
{
int ret;
u32 start_blk = 0;
@@ -594,7 +594,7 @@
if(block_addr == 0)
start_blk = start_addr;
else
- start_blk = (start_addr/MMC_BLOCK_SIZE);
+ start_blk = (u32)(start_addr/MMC_BLOCK_SIZE);
if(blk_count){
ret= zx_mmc_write(start_blk, (u8 *)src_buf, blk_count * MMC_BLOCK_SIZE);
diff --git a/upstream/linux-5.10/drivers/mtd/mtdcore.c b/upstream/linux-5.10/drivers/mtd/mtdcore.c
index a52a2c8..c07e824 100755
--- a/upstream/linux-5.10/drivers/mtd/mtdcore.c
+++ b/upstream/linux-5.10/drivers/mtd/mtdcore.c
@@ -228,6 +228,17 @@
}
static DEVICE_ATTR(ecc_strength, S_IRUGO, mtd_ecc_strength_show, NULL);
+#define MTD_RECORD_NAME_MAX (16)
+struct zxic_mtd_record
+{
+ char name[MTD_RECORD_NAME_MAX];
+ unsigned int erase_times;
+ unsigned int write_times;
+};
+
+static struct zxic_mtd_record g_zxic_mtd_record; //save data
+static int record_mtd_trigger_flag; // 0 stop record, 1 start record
+
static ssize_t mtd_bitflip_threshold_show(struct device *dev,
struct device_attribute *attr,
char *buf)
@@ -1111,6 +1122,9 @@
adjinstr.addr += mst_ofs;
+ if (record_mtd_trigger_flag && (strcmp(mtd->name, g_zxic_mtd_record.name) == 0))
+ g_zxic_mtd_record.erase_times++;
+
ret = master->_erase(master, &adjinstr);
if (adjinstr.fail_addr != MTD_FAIL_ADDR_UNKNOWN) {
@@ -1232,6 +1246,9 @@
};
int ret;
+ if (record_mtd_trigger_flag && (strcmp(mtd->name, g_zxic_mtd_record.name) == 0))
+ g_zxic_mtd_record.write_times++;
+
ret = mtd_write_oob(mtd, to, &ops);
*retlen = ops.retlen;
@@ -2203,6 +2220,107 @@
static struct proc_dir_entry *proc_mtd;
+/* Started by AICoder, pid:5fc9ey6dc555c241432c0bd800e0358e8d683380 */
+static struct proc_dir_entry *proc_record_mtd_name;
+static struct proc_dir_entry *proc_record_mtd_trigger;
+static struct proc_dir_entry *proc_record_mtd_erase_times;
+
+static ssize_t proc_record_mtd_name_read(struct file *file, char __user *user_buffer, size_t count, loff_t *offset) {
+ if (g_zxic_mtd_record.name[0] != '\0')
+ return simple_read_from_buffer(user_buffer, count, offset, g_zxic_mtd_record.name, strlen(g_zxic_mtd_record.name));
+ else
+ return 0;
+}
+
+static ssize_t proc_record_mtd_name_write(struct file *file, const char __user *user_buffer, size_t count, loff_t *offset) {
+ if (count <= 1 || count >= MTD_RECORD_NAME_MAX) {
+ return -EINVAL;
+ }
+
+ if (copy_from_user(g_zxic_mtd_record.name, user_buffer, count)) {
+ return -EFAULT;
+ }
+
+ g_zxic_mtd_record.name[count-1] = '\0'; // last 1 byte 0x0a
+ g_zxic_mtd_record.erase_times = 0;
+ g_zxic_mtd_record.write_times = 0;
+
+ return count;
+}
+
+static ssize_t proc_record_mtd_trigger_read(struct file *file, char __user *user_buffer, size_t count, loff_t *offset) {
+ if (record_mtd_trigger_flag)
+ return simple_read_from_buffer(user_buffer, count, offset, "start\n", 6);
+ else
+ return simple_read_from_buffer(user_buffer, count, offset, "stop\n", 5);
+}
+
+static ssize_t proc_record_mtd_trigger_write(struct file *file, const char __user *user_buffer, size_t count, loff_t *offset) {
+ char buffer[10];
+
+ if (count < 4 || count > 6)
+ return -EINVAL;
+ if (g_zxic_mtd_record.name[0] == '\0')
+ return -EINVAL; // mtd name not set
+ if (copy_from_user(buffer, user_buffer, count))
+ return -EFAULT;
+
+ buffer[count-1] = '\0'; // last 1 byte 0x0a
+ //printk("record mtd trigger:%s\n", buffer);
+
+ if (memcmp(buffer, "start", 5) == 0) {
+ printk(KERN_WARNING "record mtd erase and write start\n");
+ g_zxic_mtd_record.erase_times = 0;
+ g_zxic_mtd_record.write_times = 0;
+ record_mtd_trigger_flag = 1;
+ } else {
+ if (memcmp(buffer, "stop", 4) == 0)
+ {
+ printk(KERN_WARNING "record mtd erase and write stop\n");
+ record_mtd_trigger_flag = 0;
+ }
+ else
+ {
+ return -EINVAL;
+ }
+ }
+
+ return count;
+}
+
+static int proc_record_mtd_erase_times_show(struct seq_file *m, void *v)
+{
+ seq_printf(m, "mtd:%s\n", g_zxic_mtd_record.name);
+ seq_printf(m, "erase_times:%u\n", g_zxic_mtd_record.erase_times);
+ seq_printf(m, "write_times:%u\n", g_zxic_mtd_record.write_times);
+ return 0;
+}
+
+static const struct proc_ops proc_record_mtd_name_fops = {
+ .proc_read = proc_record_mtd_name_read,
+ .proc_write = proc_record_mtd_name_write,
+};
+
+static const struct proc_ops proc_record_mtd_trigger_fops = {
+ .proc_read = proc_record_mtd_trigger_read,
+ .proc_write = proc_record_mtd_trigger_write,
+};
+
+static int zxic_record_proc_init(void)
+{
+ proc_record_mtd_name = proc_create("record_mtd_name", 0666, NULL, &proc_record_mtd_name_fops);
+ if (!proc_record_mtd_name)
+ return -ENOMEM;
+ proc_record_mtd_trigger = proc_create("record_mtd_trigger", 0666, NULL, &proc_record_mtd_trigger_fops);
+ if (!proc_record_mtd_trigger)
+ return -ENOMEM;
+ proc_record_mtd_erase_times = proc_create_single("record_mtd_erase_times", 0, NULL, proc_record_mtd_erase_times_show);
+ if (!proc_record_mtd_erase_times)
+ return -ENOMEM;
+ return 0;
+}
+/* Ended by AICoder, pid:5fc9ey6dc555c241432c0bd800e0358e8d683380 */
+
static int __init init_mtd(void)
{
int ret;
@@ -2219,6 +2337,9 @@
proc_mtd = proc_create_single("mtd", 0, NULL, mtd_proc_show);
+ if (zxic_record_proc_init() < 0)
+ printk(KERN_ERR "zxic_record_proc_init error\n");
+
ret = init_mtdchar();
if (ret)
goto out_procfs;
diff --git a/upstream/linux-5.10/drivers/net/ethernet/zte/zx29_gmac.c b/upstream/linux-5.10/drivers/net/ethernet/zte/zx29_gmac.c
index 668d9d9..32cb5a5 100755
--- a/upstream/linux-5.10/drivers/net/ethernet/zte/zx29_gmac.c
+++ b/upstream/linux-5.10/drivers/net/ethernet/zte/zx29_gmac.c
@@ -25,8 +25,11 @@
#include <linux/gpio.h>
#include <linux/of_gpio.h>
#include <linux/device.h>
+#include <uapi/linux/sched/types.h>
#include "zx29_gmac.h"
+#define GMAC_RX_WORKER_TH 1
+
#define gmac_printk(_format, _args...) do{printk(KERN_INFO"gmac," _format "\n",##_args);}while(0)
static u8 zx29_gmac_addr[MAC_ADDR_LENTH] = {0xec,0x1d,0x7f,0xb0,0x2f,0x32};
@@ -86,10 +89,11 @@
d = (struct bd_tx *)priv->dma_tx_vir;
+
if (n == priv->tx_bd_offset)
return 0;
- if (d[n].TDES0 & DMA_OWNER)
+ if ( (!d) || (d[n].TDES0 & DMA_OWNER))
return 0;
if (d[n].skb == NULL)
@@ -123,7 +127,7 @@
int n = prv->rx_bd_offset;
struct bd_rx *d = (struct bd_rx*)prv->dma_rx_vir;
- if(d[n].RDES0 & DMA_OWNER)
+ if ((!d) || (d[n].RDES0 & DMA_OWNER))
{
return 0;
}
@@ -359,6 +363,56 @@
return (exhausted > 10);
}
+#ifdef GMAC_RX_WORKER_TH
+static struct task_struct *s_gmac_rx_worker = 0;
+static int ko_remove_flag = 0;
+struct semaphore s_gmac_rx_sem = {0};
+static int gmac_rx_worker(void *dev)
+{
+ struct net_device *ndev = (struct net_device *)dev;
+ struct zx29_gmac_dev *prv = (struct zx29_gmac_dev *)netdev_priv(ndev);
+ volatile unsigned *gmac = (unsigned *)ndev->base_addr;
+ unsigned int events = prv->int_event;
+
+ do {
+ down(&s_gmac_rx_sem);
+ if (ko_remove_flag)
+ return 0;
+ events = prv->int_event;
+ do {
+ if (events & INT_ST_TX)
+ zx29_gmac_tx(ndev);
+
+ if (events & INT_ST_RX)
+ zx29_gmac_rx(ndev);
+
+ events = MAC(0x1014);
+ MAC(0x1014) = events;
+ } while (events & (INT_ST_TX | INT_ST_RX));
+
+ #ifndef GMAC_NO_INT
+ mac_int_enable();
+ #endif
+ } while(1);
+
+ return 0;
+}
+
+static int zx29_gmac_worker(struct net_device* pnetdev)
+{
+ struct sched_param param = {.sched_priority = 40};
+
+ sema_init(&s_gmac_rx_sem, 0);
+
+ s_gmac_rx_worker = kthread_create(gmac_rx_worker, (void *)pnetdev, "gmac_rx_worker");
+
+ //sched_setscheduler(s_gmac_rx_worker, SCHED_RR, ¶m);
+ wake_up_process(s_gmac_rx_worker);
+
+ return 0;
+}
+
+#endif
#ifndef GMAC_NO_INT
static irqreturn_t zx29_gmac_interrupt(int irq, void *dev_id)
@@ -371,8 +425,11 @@
MAC(0x1014) = priv->int_event;
mac_int_disable();
+#ifndef GMAC_RX_WORKER_TH
tasklet_schedule(&priv->tasklet);
-
+#else
+ up(&s_gmac_rx_sem);
+#endif
return IRQ_HANDLED;
}
@@ -424,7 +481,11 @@
ktime_t gmac_schdule_time = ktime_set(0, delay_in_us * 1000);
hrtimer_forward_now(timer, gmac_schdule_time);
+#ifndef GMAC_RX_WORKER_TH
tasklet_schedule(g_gmac_tasklet);
+#else
+ up(&s_gmac_rx_sem);
+#endif
return HRTIMER_RESTART;
}
#endif
@@ -759,7 +820,7 @@
return ret;
}
- netif_carrier_on(ndev);
+// netif_carrier_on(ndev);
spin_unlock_irqrestore(&priv->lock, flags);
phy_start(priv->phydev);
@@ -1725,12 +1786,46 @@
/*zw.wang add for switching the primary/secondary mode of gmac on 20240118 end */
+/*zw.wang add a new interface to obtain the PHY link status on 20250226 begin*/
+ssize_t phy_pma_link_show(struct device *dev, struct device_attribute *attr,
+ char *buf)
+{
+ int val = 0;
+ struct platform_device *pdev = to_platform_device(dev);
+ if (!pdev) {
+ printk(KERN_ERR "%s : %s pdev : %x \n", __func__, __LINE__,
+ pdev);
+ return -1;
+ }
+ struct net_device *ndev = platform_get_drvdata(pdev);
+ if (!ndev) {
+ printk(KERN_ERR "%s : %s ndev : %x \n", __func__, __LINE__,
+ ndev);
+ return -1;
+ }
+ struct zx29_gmac_dev *priv = (struct zx29_gmac_dev *)netdev_priv(ndev);
+ if (!priv) {
+ printk(KERN_ERR "%s : %s priv : %x \n", __func__, __LINE__,
+ priv);
+ return -1;
+ }
+ mdiobus_write(priv->phydev->mdio.bus, priv->phydev->mdio.addr, 0x0d,0x1);
+ mdiobus_write(priv->phydev->mdio.bus, priv->phydev->mdio.addr, 0x0e,0x1);
+ mdiobus_write(priv->phydev->mdio.bus, priv->phydev->mdio.addr, 0x0d,0x4000 | 0x1);
+ val = mdiobus_read(priv->phydev->mdio.bus, priv->phydev->mdio.addr,0x0e);
+ sprintf(buf, "link : %s\n", (val & BIT(2)) ? "yes":"no");
+ return strlen(buf);
+}
+
+/*zw.wang add a new interface to obtain the PHY link status on 20250226 end*/
+
static DEVICE_ATTR(gmac_test, 0664, show_fun, store_fun);
static DEVICE_ATTR(mdio_test, 0664, mdio_show, mdio_store);
static DEVICE_ATTR(free_mdio, 0664, free_mdio_show, free_mdio_store);
static DEVICE_ATTR(debug_on, 0664, debug_on_show, debug_on_store);
static DEVICE_ATTR(gmac_power, 0664, gmac_power_show, gmac_power_store);//jb.qi add for gamc power down on 20231116
static DEVICE_ATTR(gmac_master_or_slave, 0664, gmac_master_or_slave_show, gmac_master_or_slave_store);//zw.wang add for switching the primary/secondary mode of gmac on 20240118
+static DEVICE_ATTR_RO(phy_pma_link); //zw.wang add a new interface to obtain the PHY link status on 20250226
static int zx29_gmac_probe(struct platform_device *pdev)
{
@@ -1759,6 +1854,7 @@
device_create_file(&pdev->dev, &dev_attr_debug_on);
device_create_file(&pdev->dev, &dev_attr_gmac_power);//jb.qi add for gamc power down on 20231116
device_create_file(&pdev->dev, &dev_attr_gmac_master_or_slave);//zw.wang add for switching the primary/secondary mode of gmac on 20240118
+ device_create_file(&pdev->dev, &dev_attr_phy_pma_link); //zw.wang add a new interface to obtain the PHY link status on 20250226
prv = netdev_priv(ndev);
memset(prv, 0, sizeof(*prv));
@@ -1851,6 +1947,10 @@
goto errdev;
}
+#ifdef GMAC_RX_WORKER_TH
+ zx29_gmac_worker(ndev);//gmac_rx_worker
+#endif
+
of_property_read_u32(np, "port-nums", &prv->nports);
of_property_read_u32(np, "rmii-ports", &prv->rmii_port);
prv->base_addr = ndev->base_addr;
@@ -1987,9 +2087,10 @@
// gpio_direction_output(priv->gpio_power[0], 1);
// msleep(500);
- unregister_netdev(ndev);
+// unregister_netdev(ndev);
phy_disconnect(priv->phydev);
+ unregister_netdev(ndev);
kobj_gmac_del(NULL);
@@ -1998,11 +2099,17 @@
#ifndef GMAC_NO_INT
free_irq(ndev->irq, ndev);
#endif
+
+#ifdef GMAC_RX_WORKER_TH
+ ko_remove_flag = 1;
+ up(&s_gmac_rx_sem);
+#endif
+
tasklet_disable(&priv->tasklet);
tasklet_kill(&priv->tasklet);
- if (priv->dma_rx_vir)
- dma_free_coherent(ndev->dev.parent, GMAC_BUF_LEN, priv->dma_rx_vir, priv->dma_rx_phy);
+ if (priv->dma_rx_vir_init)
+ dma_free_coherent(ndev->dev.parent, GMAC_BUF_LEN, priv->dma_rx_vir_init, priv->dma_rx_phy_init);
pm_relax(&pdev->dev);
free_netdev(ndev);
@@ -2020,6 +2127,7 @@
device_remove_file(&pdev->dev, &dev_attr_debug_on);
device_remove_file(&pdev->dev, &dev_attr_gmac_power);//jb.qi add for gamc power down on 20231116
device_remove_file(&pdev->dev, &dev_attr_gmac_master_or_slave);//zw.wang add for switching the primary/secondary mode of gmac on 20240118
+ device_remove_file(&pdev->dev, &dev_attr_phy_pma_link); //zw.wang add a new interface to obtain the PHY link status on 20250226
}
return 0;
}
diff --git a/upstream/linux-5.10/drivers/net/ethernet/zte/zx29_gmac_event.c b/upstream/linux-5.10/drivers/net/ethernet/zte/zx29_gmac_event.c
index 750580b..6df9cfd 100755
--- a/upstream/linux-5.10/drivers/net/ethernet/zte/zx29_gmac_event.c
+++ b/upstream/linux-5.10/drivers/net/ethernet/zte/zx29_gmac_event.c
@@ -137,7 +137,7 @@
void kobj_gmac_del(struct kobject *kobject)
{
- kset_unregister(kset_gmac);
+// kset_unregister(kset_gmac);
kobject_uevent(typekobj, KOBJ_REMOVE);
kobject_del(typekobj);
@@ -150,6 +150,7 @@
kfree(gmackobj);
+ kset_unregister(kset_gmac);
printk("[gmac kobj_test: delete!]\n");
}
EXPORT_SYMBOL(kobj_gmac_del);
@@ -278,8 +279,8 @@
}
kset_gmac = kset_create_and_add("gmac", &gmac_uevent_ops, NULL);
kobject_init(gmackobj, &gmacktype);
- kobject_add(gmackobj,&kset_gmac->kobj,"%s","gmacconfig");
gmackobj->kset = kset_gmac;
+ kobject_add(gmackobj,&kset_gmac->kobj,"%s","gmacconfig");
typekobj = kzalloc(sizeof(*typekobj),GFP_KERNEL);
if(!typekobj){
@@ -288,8 +289,8 @@
}
// kset_gmac = kset_create_and_add("gmac", &gmac_uevent_ops, NULL);
kobject_init(typekobj, &typektype);
- kobject_add(typekobj,&kset_gmac->kobj,"%s",name);
typekobj->kset = kset_gmac;
+ kobject_add(typekobj,&kset_gmac->kobj,"%s",name);
strcpy(type, name);
diff --git a/upstream/linux-5.10/drivers/net/phy/phy_device.c b/upstream/linux-5.10/drivers/net/phy/phy_device.c
index d9b53ba..f6a5a56 100755
--- a/upstream/linux-5.10/drivers/net/phy/phy_device.c
+++ b/upstream/linux-5.10/drivers/net/phy/phy_device.c
@@ -1316,6 +1316,10 @@
}
EXPORT_SYMBOL(phy_sfp_probe);
+static bool phy_drv_supports_irq(struct phy_driver *phydrv)
+{
+ return phydrv->config_intr && phydrv->ack_interrupt;
+}
/**
* phy_attach_direct - attach a network device to a given PHY device pointer
* @dev: network device to attach
@@ -1421,6 +1425,8 @@
phydev->state = PHY_READY;
+ if (!phy_drv_supports_irq(phydev->drv) && phy_interrupt_is_valid(phydev))
+ phydev->irq = PHY_POLL;
/* Port is set to PORT_TP by default and the actual PHY driver will set
* it to different value depending on the PHY configuration. If we have
* the generic PHY driver we can't figure it out, thus set the old
@@ -2819,7 +2825,7 @@
if (delay < 0)
return delay;
- if (delay && size == 0)
+ if (size == 0)
return delay;
if (delay < delay_values[0] || delay > delay_values[size - 1]) {
@@ -2852,10 +2858,6 @@
}
EXPORT_SYMBOL(phy_get_internal_delay);
-static bool phy_drv_supports_irq(struct phy_driver *phydrv)
-{
- return phydrv->config_intr && phydrv->ack_interrupt;
-}
/**
* phy_probe - probe and init a PHY device
diff --git a/upstream/linux-5.10/drivers/net/zvnet/zvnet_dev.c b/upstream/linux-5.10/drivers/net/zvnet/zvnet_dev.c
index c7da7a4..ffade7e 100755
--- a/upstream/linux-5.10/drivers/net/zvnet/zvnet_dev.c
+++ b/upstream/linux-5.10/drivers/net/zvnet/zvnet_dev.c
@@ -9,6 +9,8 @@
#include "ram_config.h"
#include <net/netfilter/nf_conntrack.h>
#include <net/SI/fast_common.h>
+#include <pub_debug_info.h>
+
/*******************************************************************************
* Macro definitions *
******************************************************************************/
@@ -50,6 +52,18 @@
unsigned short flag;
struct T_zvnet_pkt_stats pkt[2];
};
+struct zvnet_arphdr {
+ unsigned short ar_hrd; /* format of hardware address */
+ unsigned short ar_pro; /* format of protocol address */
+ unsigned char ar_hln; /* length of hardware address */
+ unsigned char ar_pln; /* length of protocol address */
+ unsigned short ar_op; /* ARP opcode (command) */
+ unsigned char ar_sha[ETH_ALEN]; /* sender hardware address */
+ unsigned char ar_sip[4]; /* sender IP address */
+ unsigned char ar_tha[ETH_ALEN]; /* target hardware address */
+ unsigned char ar_tip[4]; /* target IP address */
+};
+
/*******************************************************************************
* Local variable definitions *
******************************************************************************/
@@ -65,6 +79,7 @@
struct semaphore g_zvnet_free_sem;
struct semaphore g_zvnet_xmit_sem;
struct sk_buff_head g_zvnet_skb_xmit_queue;
+atomic_t g_zvnet_pm_flag;
unsigned int g_wrap_packet_size = 1000;
module_param(g_wrap_packet_size, int, 0644);
@@ -152,7 +167,7 @@
unsigned char *p = data;
for(i = 0; i < len && i < limit_len; i+=16)
{
- printk("0x%04x: %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n",i,
+ printk("0x%04x: %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n",i,
p[0],p[1],p[2],p[3],p[4],p[5],p[6],p[7],
p[8],p[9],p[10],p[11],p[12],p[13],p[14],p[15]);
p += 16;
@@ -160,6 +175,11 @@
}
/* Ended by AICoder, pid:z5702yf8bad07ad1448a083e806dc31250b2418f */
+void zvnet_set_pm_flag(unsigned int flag){
+ if(flag & 0x100000)
+ atomic_set(&g_zvnet_pm_flag, 1);
+}
+
int zvnet_get_index_by_netdev(struct net_device *net)
{
int i;
@@ -304,11 +324,127 @@
/* make sure we initialize shinfo sequentially */
skb_reset_network_header(skb);
skb_set_kcov_handle(skb, kcov_common_handle());
- if(unlikely(g_trace_limit > 0)){
- printk("-%s-dump_packet-start-%d\n", skb->dev->name, skb->len);
+ if(unlikely(g_trace_limit & 1)){
+ printk("-%s-dump_fromap-start-%d\n", skb->dev->name, skb->len);
zvnet_dump_packet(skb->data, skb->len, g_trace_limit);
- printk("-%s-dump_packet-end-\n", skb->dev->name);
+ printk("-%s-dump_fromap-end-\n", skb->dev->name);
}
+/* Started by AICoder, pid:j2d34uccf7y1f37146a108290182771184940711 */
+ if (atomic_read(&g_zvnet_pm_flag)) {
+ unsigned short l2_hdr_len = 0;
+ unsigned short h_proto = htons(*(unsigned short *)(skb->data + ETH_ALEN + ETH_ALEN));
+ again:
+ if (l2_hdr_len + ETH_HLEN < skb->len) {
+ switch (h_proto) {
+ case ETH_P_IP: {
+ struct iphdr *iph = (struct iphdr *)(skb->data + ETH_HLEN + l2_hdr_len);
+ if (iph->protocol == IPPROTO_TCP) {
+ struct tcphdr *tcph = (struct tcphdr *)(((unsigned char *)iph) + iph->ihl * 4);
+ char *flag;
+ if (tcph->ack) {
+ if (tcph->fin)
+ flag = "FA";
+ else if (tcph->syn)
+ flag = "SA";
+ else if (tcph->psh)
+ flag = "PA";
+ else
+ flag = "A";
+ } else {
+ if (tcph->fin)
+ flag = "F";
+ else if (tcph->syn)
+ flag = "S";
+ else if (tcph->rst)
+ flag = "R";
+ else
+ flag = "";
+ }
+ sc_debug_info_record("cap_net", "%u-%pI4-%pI4-%u%s %u:%u/%u\n",
+ pbuf_temp->dev, &iph->saddr, &iph->daddr,
+ iph->protocol, flag, ntohs(tcph->source), ntohs(tcph->dest), skb->len);
+ } else if (iph->protocol == IPPROTO_UDP) {
+ struct udphdr *udph = (struct udphdr *)(((unsigned char *)iph) + iph->ihl * 4);
+ sc_debug_info_record("cap_net", "%u-%pI4-%pI4-%u %u:%u/%u\n",
+ pbuf_temp->dev, &iph->saddr, &iph->daddr,
+ iph->protocol, ntohs(udph->source), ntohs(udph->dest), skb->len);
+ } else if (iph->protocol == IPPROTO_ICMP) {
+ struct icmphdr *icmph = (struct icmphdr *)(((unsigned char *)iph) + iph->ihl * 4);
+ sc_debug_info_record("cap_net", "%u-%pI4-%pI4-%u %u:%u/%u\n",
+ pbuf_temp->dev, &iph->saddr, &iph->daddr,
+ iph->protocol, icmph->type, icmph->code, skb->len);
+ } else {
+ sc_debug_info_record("cap_net", "%u-%pI4-%pI4-%u/%u\n",
+ pbuf_temp->dev, &iph->saddr, &iph->daddr,
+ iph->protocol, skb->len);
+ }
+ break;
+ }
+ case ETH_P_IPV6: {
+ struct ipv6hdr *iph = (struct ipv6hdr *)(skb->data + ETH_HLEN + l2_hdr_len);
+ if (iph->nexthdr == NEXTHDR_TCP) {
+ struct tcphdr *tcph = (struct tcphdr *)(((unsigned char *)iph) + sizeof(struct ipv6hdr));
+ char *flag;
+ if (tcph->ack) {
+ if (tcph->fin)
+ flag = "FA";
+ else if (tcph->syn)
+ flag = "SA";
+ else if (tcph->psh)
+ flag = "PA";
+ else
+ flag = "A";
+ } else {
+ if (tcph->fin)
+ flag = "F";
+ else if (tcph->syn)
+ flag = "S";
+ else if (tcph->rst)
+ flag = "R";
+ else
+ flag = "";
+ }
+ sc_debug_info_record("cap_net", "%u-%pI6-%pI6-%u%s %u:%u/%u\n",
+ pbuf_temp->dev, iph->saddr.s6_addr32, iph->daddr.s6_addr32,
+ iph->nexthdr, flag, ntohs(tcph->source), ntohs(tcph->dest), skb->len);
+ } else if (iph->nexthdr == NEXTHDR_UDP) {
+ struct udphdr *udph = (struct udphdr *)(((unsigned char *)iph) + sizeof(struct ipv6hdr));
+ sc_debug_info_record("cap_net", "%u-%pI6-%pI6-%u %u:%u/%u\n",
+ pbuf_temp->dev, iph->saddr.s6_addr32, iph->daddr.s6_addr32,
+ iph->nexthdr, ntohs(udph->source), ntohs(udph->dest), skb->len);
+ } else if (iph->nexthdr == NEXTHDR_ICMP) {
+ struct icmp6hdr *icmph = (struct icmp6hdr *)(((unsigned char *)iph) + sizeof(struct ipv6hdr));
+ sc_debug_info_record("cap_net", "%u-%pI6-%pI6-%u %u:%u/%u\n",
+ pbuf_temp->dev, iph->saddr.s6_addr32, iph->daddr.s6_addr32,
+ iph->nexthdr, icmph->icmp6_type, icmph->icmp6_code,skb->len);
+ } else {
+ sc_debug_info_record("cap_net", "%u-%pI6-%pI6-%u/%u\n",
+ pbuf_temp->dev, iph->saddr.s6_addr32, iph->daddr.s6_addr32,
+ iph->nexthdr, skb->len);
+ }
+ break;
+ }
+ case ETH_P_ARP: {
+ struct zvnet_arphdr *arph = (struct zvnet_arphdr *)(skb->data + ETH_HLEN + l2_hdr_len);
+ sc_debug_info_record("cap_net", "%u:%04x-%pI4-%pI4-%u/%u\n",
+ pbuf_temp->dev, h_proto, arph->ar_sip, arph->ar_tip, htons(arph->ar_op), skb->len);
+ break;
+ }
+ case ETH_P_8021Q: {
+ struct vlan_hdr *vlanh = (struct vlan_hdr *)(skb->data + ETH_HLEN + l2_hdr_len);
+ sc_debug_info_record("cap_net", "%u:%04x-%u\n",
+ pbuf_temp->dev, h_proto, htons(vlanh->h_vlan_TCI) & VLAN_VID_MASK);
+ l2_hdr_len += VLAN_HLEN;
+ h_proto = htons(vlanh->h_vlan_encapsulated_proto);
+ goto again;
+ }
+ default:
+ sc_debug_info_record("cap_net", "%u:%04x/%u\n", pbuf_temp->dev, h_proto, skb->len);
+ }
+ }
+ atomic_set(&g_zvnet_pm_flag, 0);
+ }
+/* Ended by AICoder, pid:j2d34uccf7y1f37146a108290182771184940711 */
return skb;
}
@@ -400,6 +536,11 @@
buff[i].len = skb->len;
buff[i].end_off = skb->end - skb->head;
buff[i].dev = zvnet_get_index_by_netdev(skb->dev);
+ if(unlikely(g_trace_limit & 2)){
+ printk("-%s-dump_toap-start-%d\n", skb->dev->name, skb->len);
+ zvnet_dump_packet(skb->data, skb->len, g_trace_limit);
+ printk("-%s-dump_toap-end-\n", skb->dev->name);
+ }
if(skb->capHead){
buff[i].buff = skb->capHead;
#ifdef CONFIG_FASTNAT_MODULE
@@ -500,11 +641,11 @@
data->dev = net;
data->isToap = 1;
v7_dma_map_area(data->head, data->end - data->head + sizeof(struct skb_shared_info), DMA_TO_DEVICE);
+ net->stats.tx_packets++;
+ net->stats.tx_bytes += data->len;
skb_queue_tail(&g_zvnet_skb_xmit_queue, data);
if(data->len < g_wrap_packet_size || g_zvnet_skb_xmit_queue.qlen > g_wrap_num)
up(&g_zvnet_xmit_sem);
- net->stats.tx_packets++;
- net->stats.tx_bytes += skb->len;
#else
struct zvnet *dev = netdev_priv(net);
struct zvnet_device *zvnetdev = (struct zvnet_device *)dev->dev_priv;
@@ -1240,6 +1381,7 @@
struct net_device *net = NULL;
struct zvnet_device *zvnetdev = NULL;
+ atomic_set(&g_zvnet_pm_flag, 0);
#ifdef USE_ZVNET_PACKET
skb_queue_head_init(&g_zvnet_skb_xmit_queue);
spin_lock_init(&g_zvnet_free_lock);
diff --git a/upstream/linux-5.10/drivers/soc/sc/rpmsg/zx29_icp.c b/upstream/linux-5.10/drivers/soc/sc/rpmsg/zx29_icp.c
index 3c5ba58..0e1ca16 100755
--- a/upstream/linux-5.10/drivers/soc/sc/rpmsg/zx29_icp.c
+++ b/upstream/linux-5.10/drivers/soc/sc/rpmsg/zx29_icp.c
@@ -324,7 +324,7 @@
[40] = "at channel 40",
[41] = "voice buffer",
};
-
+extern void zvnet_set_pm_flag(unsigned int flag);
void show_icp_state(T_ZDrvRpMsg_ActorID actorID)
{
unsigned int hw, lw;
@@ -334,6 +334,7 @@
return;
icp_get_int_info(actorID, &hw, &lw);
+ zvnet_set_pm_flag(lw);
pr_info("[SLP] icpwake: 0x%x 0x%x\n", hw, lw);
sc_debug_info_record(MODULE_ID_CAP_PM, " icpwake: 0x%x 0x%x\n", hw, lw);
diff --git a/upstream/linux-5.10/drivers/tty/serial/zx29_uart.c b/upstream/linux-5.10/drivers/tty/serial/zx29_uart.c
index b29437a..7029976 100755
--- a/upstream/linux-5.10/drivers/tty/serial/zx29_uart.c
+++ b/upstream/linux-5.10/drivers/tty/serial/zx29_uart.c
@@ -591,6 +591,48 @@
);
}
DEVICE_ATTR(statics, S_IRUGO, statics_show, NULL);
+
+static unsigned int uart_io_seletc = 0;
+
+
+static ssize_t uart_io_select_show(struct device *_dev,
+struct device_attribute *attr, char *buf)
+{
+struct platform_device *pdev = container_of(_dev, struct platform_device, dev);
+//struct zx29_uart_platdata *pdata = pdev->dev.platform_data;
+
+return sprintf(buf, "%d\n",uart_io_seletc );
+
+}
+
+static ssize_t uart_io_select_store(struct device *_dev,
+struct device_attribute *attr,
+const char *buf, size_t count)
+{
+ uint32_t flag = 0;
+struct platform_device *pdev = container_of(_dev, struct platform_device, dev);
+flag = simple_strtoul(buf, NULL, 16);
+
+if(flag == 1){
+ printk("uart io is 1\n");
+pinctrl_pm_select_default_state(_dev);
+}else if(flag == 0){
+pinctrl_pm_select_sleep_state(_dev);
+}
+else{
+printk("uart io select flag invaild\n");
+}
+
+uart_io_seletc = flag;
+
+
+
+return count;
+}
+
+DEVICE_ATTR(uart_io_select, S_IRUGO | S_IWUSR, uart_io_select_show,
+ uart_io_select_store);
+
#define VEHICLE_USE_ONE_UART_LOG 1
#if VEHICLE_USE_ONE_UART_LOG
#define ICP_CORE_ID_PS CORE_PS0
@@ -4412,6 +4454,9 @@
error = device_create_file(&pdev->dev, &dev_attr_app_ctrl);
}
+ if(pdev->id == 2){
+ error = device_create_file(&pdev->dev, &dev_attr_uart_io_select);
+ }
error = device_create_file(&pdev->dev, &dev_attr_statics);
device_init_wakeup(&pdev->dev, true);
/*
diff --git a/upstream/linux-5.10/include/linux/mfd/zx234290.h b/upstream/linux-5.10/include/linux/mfd/zx234290.h
index ea89815..40e71bf 100755
--- a/upstream/linux-5.10/include/linux/mfd/zx234290.h
+++ b/upstream/linux-5.10/include/linux/mfd/zx234290.h
@@ -1009,24 +1009,6 @@
SINK_CURRENT_MAX
}T_ZDrvZx234297_SINK_CURRENT;
-typedef enum _T_ZDrvZx234290_ResetType
-{
-#if 0
- ZX234290_USER_RST_UNDEFINE = 0,
- ZX234290_USER_RST_TO_NORMAL = 1,
- ZX234290_USER_RST_TO_CHARGER = 2,
- ZX234290_USER_RST_TO_ALARM = 3,
-#else
- ZX234290_USER_RST_UNDEFINE = 3,
- ZX234290_USER_RST_TO_NORMAL = 0,
- ZX234290_USER_RST_TO_CHARGER = 1,
- ZX234290_USER_RST_TO_ALARM = 2,
-#endif
- ZX234290_USER_RST_TO_EXCEPT = 4,
-
- ZX234290_USER_RST_MAX
-}T_ZDrvZx234290_ResetType;
-
int zx234290_get_chip_version(void);
int zx234290_irq_init(struct zx234290 *zx234290);
diff --git a/upstream/linux-5.10/include/linux/mmc/mmc_func.h b/upstream/linux-5.10/include/linux/mmc/mmc_func.h
index b2636ab..911c010 100755
--- a/upstream/linux-5.10/include/linux/mmc/mmc_func.h
+++ b/upstream/linux-5.10/include/linux/mmc/mmc_func.h
@@ -23,7 +23,7 @@
* data_size: the size of data you want to write .defined by byte
* src_buf: data buffer where log or file stored;
*/
-int mmc_bwrite(u32 start_addr, u32 data_size, void *src_buf);
+int mmc_bwrite(u64 start_addr, u32 data_size, void *src_buf);
/*
* start_addr: the address is the emmc address you want to write,and it size is
@@ -32,6 +32,6 @@
* src_buf: data buffer where log or file will store;
*/
-int mmc_bread(u32 start_addr, u32 data_size, void *dst);
+int mmc_bread(u64 start_addr, u32 data_size, void *dst);
#endif /* LINUX_MMC_MMC_FUNC_H */
diff --git a/upstream/linux-5.10/kernel/ramdump/ramdump_client_cap.c b/upstream/linux-5.10/kernel/ramdump/ramdump_client_cap.c
index bcb6a53..1492b49 100755
--- a/upstream/linux-5.10/kernel/ramdump/ramdump_client_cap.c
+++ b/upstream/linux-5.10/kernel/ramdump/ramdump_client_cap.c
@@ -45,6 +45,7 @@
extern void ramdump_data_transfer_to_device(void);
extern void ramdump_oss_data_trans_init(void);
extern unsigned char *ramdump_export_flag_base;
+extern void zxic_reset_reason(int reason, const char *cpu, const char *app);
/*******************************************************************************
* ¾Ö²¿¾²Ì¬±äÁ¿¶¨Òå *
@@ -71,7 +72,7 @@
unsigned char *ramdump_cap_error_log = NULL;
unsigned int *cap_ddr_len_base = NULL;
unsigned int sysctl_ramdump_emmc_size = 0x0;
-unsigned int sysctl_ramdump_emmc_start_addr = 0xFFFF;
+u64 sysctl_ramdump_emmc_start_addr = 0xFFFF;
static struct ctl_table cfg_ramdump_array[] = {
#ifdef CONFIG_RAMDUMP_USER
@@ -128,7 +129,7 @@
{
ramdump_msg_t *icp_msg = (ramdump_msg_t *)buf;
- ramdump_server_exp_core = RAMDUMP_SUCCESS;
+ ramdump_server_exp_core = RAMDUMP_TRUE;
switch(icp_msg->msg_id)
{
@@ -413,6 +414,9 @@
void ramdump_entry (void)
{
unsigned long flags;
+
+ if (ramdump_server_exp_core == RAMDUMP_FALSE)
+ zxic_reset_reason(1, "cap", current->comm); /* not ap ramdump and cap ramdump */
if (sysctl_ramdump_on_panic == false)
return;
diff --git a/upstream/linux-5.10/kernel/ramdump/ramdump_device_trans.c b/upstream/linux-5.10/kernel/ramdump/ramdump_device_trans.c
index f3e91e9..0b0f0dc 100755
--- a/upstream/linux-5.10/kernel/ramdump/ramdump_device_trans.c
+++ b/upstream/linux-5.10/kernel/ramdump/ramdump_device_trans.c
@@ -51,6 +51,8 @@
extern unsigned int ramdump_compress_flag;
extern unsigned char *ramdump_log_buf;
extern unsigned int ramdump_export_mode;
+extern unsigned int ramdump_emmc_size;
+extern unsigned int ramdump_spinand_size;
/*******************************************************************************
* Macro definitions *
@@ -288,6 +290,8 @@
*******************************************************************************/
void ramdump_device_close(void)
{
+ g_ramdump_dev_fp->file_num = ramdump_device_file_cnt;
+
if(ramdump_export_mode == RAMDUMP_MODE_EMMC)
{
#ifdef CONFIG_RAMDUMP_EMMC
@@ -333,11 +337,16 @@
int ramdump_device_write_file(ramdump_trans_server_file_info_req *server_to_cap)
{
int ret = -1;
+ unsigned int file_size = 0;
+
+ /* Started by AICoder, pid:wcfb91c2aa35add146d90b5530cd112845133621 */
+ file_size = server_to_cap->file_size;
if(ramdump_export_mode == RAMDUMP_MODE_EMMC)
{
#ifdef CONFIG_RAMDUMP_EMMC
- if (ramdump_emmc_offset >= RAMDUMP_TRANS_EMMC_LEN)
+ if ((ramdump_emmc_offset >= RAMDUMP_TRANS_EMMC_LEN)
+ || ((ramdump_emmc_offset + file_size) > ramdump_emmc_size))
return -1;
ret = ramdump_fill_header(server_to_cap->file_name,
@@ -349,9 +358,11 @@
else if(ramdump_export_mode == RAMDUMP_MODE_SPINAND)
{
#ifdef CONFIG_MTD_SPI_NAND
- if (ramdump_spinand_offset >= RAMDUMP_SPINAND_LEN)
+ if ((ramdump_spinand_offset >= RAMDUMP_SPINAND_LEN)
+ || ((ramdump_spinand_offset + file_size) > ramdump_spinand_size))
return -1;
-
+ /* Ended by AICoder, pid:wcfb91c2aa35add146d90b5530cd112845133621 */
+
ret = ramdump_fill_header(server_to_cap->file_name,
server_to_cap->file_size,
&ramdump_spinand_fp,
@@ -557,9 +568,9 @@
int ramdump_device_write_data(ramdump_shmem_t *msg, unsigned int size, ssize_t *dstlen)
{
int ret = 0;
-
+
if(ramdump_export_mode == RAMDUMP_MODE_EMMC)
- {
+ {
#ifdef CONFIG_RAMDUMP_EMMC
ret = ramdump_emmc_write_data(msg, &ramdump_device_fp, size);
if(ret < 0)
@@ -637,8 +648,6 @@
ramdump_trans_server_interactive_req *server_to_cap_msg = (ramdump_trans_server_interactive_req *)req_buf;
/* data from server to cap */
ramdump_file_num = server_to_cap_msg->file_num;
- ramdump_device_fp.file_num += ramdump_file_num;
- ramdump_spinand_fp.file_num += ramdump_file_num;
/* data from cap to server */
cap_to_server_msg.cmd = RAMDUMP_PC_FILE_INFO_READ_REQ;
@@ -658,8 +667,12 @@
/*device memory file create*/
if(ramdump_device_write_file(server_to_cap_msg) == -1){
cap_to_server_msg.cmd = RAMDUMP_PC_FILE_TRANS_DONE_REQ;
- ramdump_device_write_file_head();//±£Ö¤³ö´íǰ¼¸¸öÎļþ¾ùд¶Ô¡£
- ramdump_printf("ramdump write emmc file error!\n");
+ /* Started by AICoder, pid:ddd3ag3c37x6798145ec08ac1067150b58735197 */
+ ramdump_oss_data_trans_write(
+ (unsigned char*)(&cap_to_server_msg),
+ sizeof(cap_to_server_msg));
+ break;
+ /* Ended by AICoder, pid:ddd3ag3c37x6798145ec08ac1067150b58735197 */
}
file_size = server_to_cap_msg->file_size;
file_offset = 0;
@@ -675,7 +688,8 @@
file_trans_size = cap_to_server_msg.length;
file_left_size = file_left_size - cap_to_server_msg.length;
file_offset = file_offset + cap_to_server_msg.length;
- printk("device memory trans file:%s !!!\n", server_to_cap_msg->file_name);
+
+ printk("device memory trans file:%-30s size %9d, offset %9d!!!\n", server_to_cap_msg->file_name, file_size, ramdump_emmc_offset);
/* interactive data trans */
ramdump_oss_data_trans_write(
(unsigned char*)(&cap_to_server_msg),
@@ -690,14 +704,24 @@
/* data from server to cap */
ramdump_shmem_t *server_to_cap_msg = (ramdump_shmem_t *)ramdump_shared_mem_base;
server_to_cap_msg->core_flag = 0;
+
/*data from cap to emmc*/
-
write_len = ramdump_device_write_data(server_to_cap_msg, file_left_size, &file_dstlen);
- if(write_len < 0)
+ if(write_len < 0 )
{
- ramdump_printf("ramdump write emmc data error!\n");
+ /* Started by AICoder, pid:u5befs8483y615f142ce0bda306d660bed685275 */
+ if(write_len == -RAMDUMP_NO_FREE_SPACE)
+ {
+ cap_to_server_msg.cmd = RAMDUMP_PC_FILE_TRANS_DONE_REQ;
+ ramdump_oss_data_trans_write(
+ (unsigned char*)(&cap_to_server_msg),
+ sizeof(cap_to_server_msg));
+ break;
+ }
+ else
+ ramdump_printf("ramdump write emmc data error!\n");
+ /* Ended by AICoder, pid:u5befs8483y615f142ce0bda306d660bed685275 */
}
-
/*ÅжÏÊ£Óà´óС*/
if (file_left_size == 0)
{
diff --git a/upstream/linux-5.10/kernel/ramdump/ramdump_emmc.c b/upstream/linux-5.10/kernel/ramdump/ramdump_emmc.c
index 0c28f27..5054440 100755
--- a/upstream/linux-5.10/kernel/ramdump/ramdump_emmc.c
+++ b/upstream/linux-5.10/kernel/ramdump/ramdump_emmc.c
@@ -128,16 +128,28 @@
int ramdump_emmc_write_data(ramdump_shmem_t *msg, ramdump_file_t *fp, unsigned int size)
{
int ret = 0;
- unsigned int buffer = RAMDUMP_EMMC_ADDR + ramdump_emmc_offset;
+ u64 buffer = RAMDUMP_EMMC_ADDR + ramdump_emmc_offset;
if (ramdump_device_file_cnt >= RAMDUMP_FILE_NUM_MAX)
return -1;
while(1){
if ((msg->core_flag == 1) && (msg->rw_flag == 2)){
- if(msg->size >= (ramdump_emmc_size - fp->file_fp[ramdump_device_file_cnt].offset))
- return -1;
+ /* Started by AICoder, pid:fe298k6b27edc1c14f9e0be2e0451e1abfc5830e */
+ if((ramdump_emmc_size < ramdump_emmc_offset)
+ || (msg->size >= (ramdump_emmc_size - fp->file_fp[ramdump_device_file_cnt].offset)))
+ {
+ printk("[ramdump] No space left in emmc, Emmc_size is %ld,ramdump_emmc_offset is %d!\n", ramdump_emmc_size, ramdump_emmc_offset);
+ return -RAMDUMP_NO_FREE_SPACE;
+ }
ret = mmc_bwrite(buffer, msg->size, msg->buf);
+ if(ret < 0)
+ {
+ printk("[ramdump] ramdump_emmc_write_data Error.\n");
+ ramdump_wait_delay(0);
+ continue;
+ }
+ /* Ended by AICoder, pid:fe298k6b27edc1c14f9e0be2e0451e1abfc5830e */
ramdump_emmc_offset = ramdump_emmc_offset + roundup(msg->size, RAMDUMP_EMMC_ALIGN_SIZE);
msg->core_flag = 1;
msg->rw_flag = 1;
diff --git a/upstream/linux-5.10/kernel/ramdump/ramdump_emmc.h b/upstream/linux-5.10/kernel/ramdump/ramdump_emmc.h
index 1028ab2..6c9817e 100755
--- a/upstream/linux-5.10/kernel/ramdump/ramdump_emmc.h
+++ b/upstream/linux-5.10/kernel/ramdump/ramdump_emmc.h
@@ -24,13 +24,14 @@
/*******************************************************************************
* Íⲿ±äÁ¿ÉùÃ÷ *
*******************************************************************************/
-extern unsigned int sysctl_ramdump_emmc_start_addr;
+extern u64 sysctl_ramdump_emmc_start_addr;
extern unsigned int sysctl_ramdump_emmc_size;
extern volatile unsigned int ramdump_emmc_offset;
/*******************************************************************************
* ºê¶¨Òå *
*******************************************************************************/
+#define RAMDUMP_NO_FREE_SPACE (2)
#define RAMDUMP_EMMC_ADDR (sysctl_ramdump_emmc_start_addr * 512)
#define RAMDUMP_TRANS_EMMC_LEN (sysctl_ramdump_emmc_size * 512)
diff --git a/upstream/linux-5.10/kernel/tracker.c b/upstream/linux-5.10/kernel/tracker.c
index 6f7e1ab..792818b 100755
--- a/upstream/linux-5.10/kernel/tracker.c
+++ b/upstream/linux-5.10/kernel/tracker.c
@@ -63,6 +63,7 @@
#define OS_IRAM_SOFTIRQ_END (OS_IRAM_SOFTIRQ_START + sizeof(t_os_iram_statistic))
#define OS_IRAM_TIMER_START (OS_IRAM_SOFTIRQ_END + sizeof(t_os_iram_statistic))
#define OS_IRAM_TIMER_END (OS_IRAM_TIMER_START + sizeof(t_os_iram_statistic))
+#define OS_IRAM_RESET_REASON_START (OS_STATISTIC_IRAM_BASE + 0x800 - sizeof(T_Reset_Reason))
#endif
#define os_statistic_check() *((volatile unsigned long *)OS_STATISTIC_IRAM_BASE)
@@ -98,6 +99,12 @@
} statistics[OS_DDR_STATISTIC_CNT];
}t_os_ddr_statistic;
+typedef struct
+{
+ char ramdump_reason[32]; //±ÈÈ磺ramdump_ap_appname
+ char kernel_reboot[32]; //±ÈÈ磺reboot_ap_appname
+} T_Reset_Reason;
+
/*******************************************************************************
* È«¾Ö±äÁ¿ *
*******************************************************************************/
@@ -134,6 +141,7 @@
volatile static t_os_ddr_statistic *g_os_ddr_softirq_end_statistic;
volatile static t_os_ddr_statistic *g_os_ddr_timer_start_statistic;
volatile static t_os_ddr_statistic *g_os_ddr_timer_end_statistic;
+volatile T_Reset_Reason *g_os_reset_reason;
#endif
/*******************************************************************************
@@ -418,7 +426,32 @@
os_statistic_in_ddr(g_os_ddr_timer_end_statistic, func, time);
os_statistic_info_update();
}
+/*
+reason: 1 for ramdump, 2 for reboot
+cpu: ap/cap/rpm/phy
+app: current->comm
+*/
+/* Started by AICoder, pid:pf139dce4f7776c149ec081b508bae14e6084ede */
+void zxic_reset_reason(int reason, const char *cpu, const char *app)
+{
+ char buffer[32];
+ memset(buffer, 0, sizeof(buffer));
+ switch (reason)
+ {
+ case 1:
+ snprintf(buffer, 32, "reset_ramdump_%s_%s", cpu, app);
+ memcpy(g_os_reset_reason->ramdump_reason, buffer, sizeof(buffer));
+ break;
+ case 2:
+ snprintf(buffer, 32, "reset_kreboot_%s_%s", cpu, app);
+ memcpy(g_os_reset_reason->kernel_reboot, buffer, sizeof(buffer));
+ break;
+ default:
+ break;
+ }
+}
+/* Ended by AICoder, pid:pf139dce4f7776c149ec081b508bae14e6084ede */
/*******************************************************************************
* ¹¦ÄÜÃèÊö: ¹ì¼£Í³¼Æµ½DDR
@@ -438,9 +471,10 @@
#ifdef IRAM_BASE_ADDR_VA
g_zxic_trace_apcpu_addr = IRAM_BASE_ADDR_OS_STATISTIC_PSCPU;
#else
- g_zxic_trace_apcpu_addr = ioremap(IRAM_BASE_ADDR_OS_STATISTIC_PSCPU, IRAM_BASE_LEN_OS_STATISTIC_PSCPU);
+ g_zxic_trace_apcpu_addr = ioremap(IRAM_BASE_ADDR_OS_STATISTIC_PSCPU, IRAM_BASE_LEN_OS_STATISTIC_PSCPU + IRAM_BASE_LEN_OS_STATISTIC_PHYCPU + IRAM_BASE_LEN_OS_STATISTIC_APCPU);
#endif
+ g_os_reset_reason = (T_Reset_Reason *)OS_IRAM_RESET_REASON_START;
/*
init_timer(&timer);
timer.expires = jiffies + 40*HZ;//msecs_to_jiffies(40*1000);//ÑÓ³Ù40Ãë
diff --git a/upstream/linux-5.10/sound/soc/sanechips/zx29_ak4940.c b/upstream/linux-5.10/sound/soc/sanechips/zx29_ak4940.c
index f730067..efdfe9e 100755
--- a/upstream/linux-5.10/sound/soc/sanechips/zx29_ak4940.c
+++ b/upstream/linux-5.10/sound/soc/sanechips/zx29_ak4940.c
@@ -37,6 +37,7 @@
#include "i2s.h"
+#include "pub_debug_info.h"
#define ZX29_I2S_TOP_LOOP_REG 0xac
@@ -362,48 +363,97 @@
#endif
- static int zx29startup(struct snd_pcm_substream *substream)
- {
- // int ret = 0;
- print_audio("Alsa Entered func %s\n", __func__);
- //CPPS_FUNC(cpps_callbacks, zDrv_Audio_Printf)("Alsa: zx29_startup device=%d,stream=%d\n", substream->pcm->device, substream->stream);
+/* Started by AICoder, pid:r53959b7c94916e146e3093b301a356223b009fa */
+static int zx29startup(struct snd_pcm_substream *substream)
+{
+ //int ret = 0;
+ print_audio("Alsa Entered func %s\n", __func__);
+ //CPPS_FUNC(cpps_callbacks, zDrv_Audio_Printf)("Alsa: zx29_startup device=%d,stream=%d\n", substream->pcm->device, substream->stream);
+
+ struct snd_pcm *pcmC0D0p = snd_lookup_minor_data(16, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
+ struct snd_pcm *pcmC0D1p = snd_lookup_minor_data(17, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
+ struct snd_pcm *pcmC0D2p = snd_lookup_minor_data(18, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
+ struct snd_pcm *pcmC0D3p = snd_lookup_minor_data(19, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
+ //struct snd_pcm *pcmC0D4p = snd_lookup_minor_data(20, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
- struct snd_pcm *pcmC0D0p = snd_lookup_minor_data(16, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
- struct snd_pcm *pcmC0D1p = snd_lookup_minor_data(17, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
- struct snd_pcm *pcmC0D2p = snd_lookup_minor_data(18, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
- struct snd_pcm *pcmC0D3p = snd_lookup_minor_data(19, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
- if ((pcmC0D0p == NULL) || (pcmC0D1p == NULL) || (pcmC0D2p == NULL) || (pcmC0D3p == NULL))
- return -EINVAL;
- if ((pcmC0D0p->streams[0].substream_opened && pcmC0D1p->streams[0].substream_opened) ||
- (pcmC0D0p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) ||
- (pcmC0D0p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) ||
- (pcmC0D1p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) ||
- (pcmC0D1p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) ||
- (pcmC0D2p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened))
- BUG();
+ struct snd_pcm *pcmC0D0c = snd_lookup_minor_data(24, SNDRV_DEVICE_TYPE_PCM_CAPTURE);
+ struct snd_pcm *pcmC0D1c = snd_lookup_minor_data(25, SNDRV_DEVICE_TYPE_PCM_CAPTURE);
+ struct snd_pcm *pcmC0D2c = snd_lookup_minor_data(26, SNDRV_DEVICE_TYPE_PCM_CAPTURE);
+ struct snd_pcm *pcmC0D3c = snd_lookup_minor_data(27, SNDRV_DEVICE_TYPE_PCM_CAPTURE);
+ //struct snd_pcm *pcmC0D4c = snd_lookup_minor_data(28, SNDRV_DEVICE_TYPE_PCM_CAPTURE);
+
+ if ((pcmC0D0p == NULL) || (pcmC0D1p == NULL) || (pcmC0D2p == NULL) || (pcmC0D3p == NULL))
+ {
+ print_audio("Alsa Entered func %s, pcmC0D0p=%p, pcmC0D1p=%p, pcmC0D2p=%p, pcmC0D3p=%p\n", __func__,
+ pcmC0D0p, pcmC0D1p, pcmC0D2p, pcmC0D3p);
+ return -EINVAL;
+ }
+ if ((pcmC0D0p->streams[0].substream_opened && pcmC0D1p->streams[0].substream_opened) ||
+ (pcmC0D0p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) ||
+ (pcmC0D0p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) ||
+ (pcmC0D1p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) ||
+ (pcmC0D1p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) ||
+ (pcmC0D2p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened))
+ {
+ print_audio("Alsa Entered func %s error busy, pcmC0D0p.opened=%d, pcmC0D1p.opened=%d, pcmC0D2p.opened=%d, pcmC0D3p.opened=%d\n",
+ __func__, pcmC0D0p->streams[0].substream_opened, pcmC0D1p->streams[0].substream_opened,
+ pcmC0D2p->streams[0].substream_opened, pcmC0D3p->streams[0].substream_opened);
+ sc_debug_info_record(MODULE_ID_CAP_AUDIO, "Alsa %s err, opened value pcmC0D0p=%d, pcmC0D1p=%d, pcmC0D2p=%d, pcmC0D3p=%d\n",
+ __func__, pcmC0D0p->streams[0].substream_opened, pcmC0D1p->streams[0].substream_opened,
+ pcmC0D2p->streams[0].substream_opened, pcmC0D3p->streams[0].substream_opened);
+
+ return -EBUSY;
+ //BUG();
+ }
+
+ if ((pcmC0D0c == NULL) || (pcmC0D1c == NULL) || (pcmC0D2c == NULL) || (pcmC0D3c == NULL))
+ {
+ print_audio("Alsa Entered func %s, pcmC0D0c=%p, pcmC0D1c=%p, pcmC0D2c=%p, pcmC0D3c=%p\n", __func__,
+ pcmC0D0c, pcmC0D1c, pcmC0D2c, pcmC0D3c);
+ return -EINVAL;
+ }
+ if ((pcmC0D0c->streams[1].substream_opened && pcmC0D1c->streams[1].substream_opened) ||
+ (pcmC0D0c->streams[1].substream_opened && pcmC0D2c->streams[1].substream_opened) ||
+ (pcmC0D0c->streams[1].substream_opened && pcmC0D3c->streams[1].substream_opened) ||
+ (pcmC0D1c->streams[1].substream_opened && pcmC0D2c->streams[1].substream_opened) ||
+ (pcmC0D1c->streams[1].substream_opened && pcmC0D3c->streams[1].substream_opened) ||
+ (pcmC0D2c->streams[1].substream_opened && pcmC0D3c->streams[1].substream_opened))
+ {
+ print_audio("Alsa Entered func %s error busy, pcmC0D0c.opened=%d, pcmC0D1c.opened=%d, pcmC0D2c.opened=%d,pcmC0D3c.opened=%d\n",
+ __func__, pcmC0D0c->streams[1].substream_opened, pcmC0D1c->streams[1].substream_opened,
+ pcmC0D2c->streams[1].substream_opened, pcmC0D3c->streams[1].substream_opened,);
+ sc_debug_info_record(MODULE_ID_CAP_AUDIO, "Alsa %s err, opened value pcmC0D0c=%d, pcmC0D1c=%d, pcmC0D2c=%d, pcmC0D3c=%d\n",
+ __func__, pcmC0D0c->streams[1].substream_opened, pcmC0D1c->streams[1].substream_opened,
+ pcmC0D2c->streams[1].substream_opened, pcmC0D3c->streams[1].substream_opened);
+
+ return -EBUSY;
+ //BUG();
+ }
+
#if 0
- unsigned long flags;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
- gpio_set_value(ZX29_GPIO_125, GPIO_LOW);
- mdelay(1);
-
- raw_spin_lock_irqsave(&codec_pa_lock, flags);
- gpio_set_value(ZX29_GPIO_125, GPIO_HIGH);
- udelay(2);
- gpio_set_value(ZX29_GPIO_125, GPIO_LOW);
- udelay(2);
- gpio_set_value(ZX29_GPIO_125, GPIO_HIGH);
- udelay(2);
- gpio_set_value(ZX29_GPIO_125, GPIO_LOW);
- udelay(2);
- gpio_set_value(ZX29_GPIO_125, GPIO_HIGH);
- raw_spin_unlock_irqrestore(&codec_pa_lock, flags);
- }
+ unsigned long flags;
+ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ gpio_set_value(ZX29_GPIO_125, GPIO_LOW);
+ mdelay(1);
+
+ raw_spin_lock_irqsave(&codec_pa_lock, flags);
+ gpio_set_value(ZX29_GPIO_125, GPIO_HIGH);
+ udelay(2);
+ gpio_set_value(ZX29_GPIO_125, GPIO_LOW);
+ udelay(2);
+ gpio_set_value(ZX29_GPIO_125, GPIO_HIGH);
+ udelay(2);
+ gpio_set_value(ZX29_GPIO_125, GPIO_LOW);
+ udelay(2);
+ gpio_set_value(ZX29_GPIO_125, GPIO_HIGH);
+ raw_spin_unlock_irqrestore(&codec_pa_lock, flags);
+ }
#endif
-
- return 0;
- }
+
+ return 0;
+}
+/* Ended by AICoder, pid:r53959b7c94916e146e3093b301a356223b009fa */
static void zx29_shutdown(struct snd_pcm_substream *substream)
{
diff --git a/upstream/linux-5.10/sound/soc/sanechips/zx29_dummycodec.c b/upstream/linux-5.10/sound/soc/sanechips/zx29_dummycodec.c
index 1a8cf3e..ff07416 100755
--- a/upstream/linux-5.10/sound/soc/sanechips/zx29_dummycodec.c
+++ b/upstream/linux-5.10/sound/soc/sanechips/zx29_dummycodec.c
@@ -36,6 +36,7 @@
#include "i2s.h"
+#include "pub_debug_info.h"
#define ZX29_I2S_TOP_LOOP_REG 0x60
@@ -361,53 +362,102 @@
#endif
- static int zx29startup(struct snd_pcm_substream *substream)
- {
- // int ret = 0;
- print_audio("Alsa Entered func %s\n", __func__);
- //CPPS_FUNC(cpps_callbacks, zDrv_Audio_Printf)("Alsa: zx29_startup device=%d,stream=%d\n", substream->pcm->device, substream->stream);
+/* Started by AICoder, pid:53525s2951m0dfb1406409962017998611b17cc1 */
+static int zx29startup(struct snd_pcm_substream *substream)
+{
+ //int ret = 0;
+ print_audio("Alsa Entered func %s\n", __func__);
+ //CPPS_FUNC(cpps_callbacks, zDrv_Audio_Printf)("Alsa: zx29_startup device=%d,stream=%d\n", substream->pcm->device, substream->stream);
+
+ struct snd_pcm *pcmC0D0p = snd_lookup_minor_data(16, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
+ struct snd_pcm *pcmC0D1p = snd_lookup_minor_data(17, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
+ struct snd_pcm *pcmC0D2p = snd_lookup_minor_data(18, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
+ struct snd_pcm *pcmC0D3p = snd_lookup_minor_data(19, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
+ //struct snd_pcm *pcmC0D4p = snd_lookup_minor_data(20, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
- struct snd_pcm *pcmC0D0p = snd_lookup_minor_data(16, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
- struct snd_pcm *pcmC0D1p = snd_lookup_minor_data(17, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
- struct snd_pcm *pcmC0D2p = snd_lookup_minor_data(18, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
- struct snd_pcm *pcmC0D3p = snd_lookup_minor_data(19, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
- if ((pcmC0D0p == NULL) || (pcmC0D1p == NULL) || (pcmC0D2p == NULL) || (pcmC0D3p == NULL))
- return -EINVAL;
- if ((pcmC0D0p->streams[0].substream_opened && pcmC0D1p->streams[0].substream_opened) ||
- (pcmC0D0p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) ||
- (pcmC0D0p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) ||
- (pcmC0D1p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) ||
- (pcmC0D1p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) ||
- (pcmC0D2p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened))
- BUG();
+ struct snd_pcm *pcmC0D0c = snd_lookup_minor_data(24, SNDRV_DEVICE_TYPE_PCM_CAPTURE);
+ struct snd_pcm *pcmC0D1c = snd_lookup_minor_data(25, SNDRV_DEVICE_TYPE_PCM_CAPTURE);
+ struct snd_pcm *pcmC0D2c = snd_lookup_minor_data(26, SNDRV_DEVICE_TYPE_PCM_CAPTURE);
+ struct snd_pcm *pcmC0D3c = snd_lookup_minor_data(27, SNDRV_DEVICE_TYPE_PCM_CAPTURE);
+ //struct snd_pcm *pcmC0D4c = snd_lookup_minor_data(28, SNDRV_DEVICE_TYPE_PCM_CAPTURE);
+
+ if ((pcmC0D0p == NULL) || (pcmC0D1p == NULL) || (pcmC0D2p == NULL) || (pcmC0D3p == NULL))
+ {
+ print_audio("Alsa Entered func %s, pcmC0D0p=%p, pcmC0D1p=%p, pcmC0D2p=%p, pcmC0D3p=%p\n", __func__,
+ pcmC0D0p, pcmC0D1p, pcmC0D2p, pcmC0D3p);
+ return -EINVAL;
+ }
+ if ((pcmC0D0p->streams[0].substream_opened && pcmC0D1p->streams[0].substream_opened) ||
+ (pcmC0D0p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) ||
+ (pcmC0D0p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) ||
+ (pcmC0D1p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) ||
+ (pcmC0D1p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) ||
+ (pcmC0D2p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened))
+ {
+ print_audio("Alsa Entered func %s error busy, pcmC0D0p.opened=%d, pcmC0D1p.opened=%d, pcmC0D2p.opened=%d, pcmC0D3p.opened=%d\n",
+ __func__, pcmC0D0p->streams[0].substream_opened, pcmC0D1p->streams[0].substream_opened,
+ pcmC0D2p->streams[0].substream_opened, pcmC0D3p->streams[0].substream_opened);
+ sc_debug_info_record(MODULE_ID_CAP_AUDIO, "Alsa %s err, opened value pcmC0D0p=%d, pcmC0D1p=%d, pcmC0D2p=%d, pcmC0D3p=%d\n",
+ __func__, pcmC0D0p->streams[0].substream_opened, pcmC0D1p->streams[0].substream_opened,
+ pcmC0D2p->streams[0].substream_opened, pcmC0D3p->streams[0].substream_opened);
+
+ return -EBUSY;
+ //BUG();
+ }
+
+ if ((pcmC0D0c == NULL) || (pcmC0D1c == NULL) || (pcmC0D2c == NULL) || (pcmC0D3c == NULL))
+ {
+ print_audio("Alsa Entered func %s, pcmC0D0c=%p, pcmC0D1c=%p, pcmC0D2c=%p, pcmC0D3c=%p\n", __func__,
+ pcmC0D0c, pcmC0D1c, pcmC0D2c, pcmC0D3c);
+ return -EINVAL;
+ }
+ if ((pcmC0D0c->streams[1].substream_opened && pcmC0D1c->streams[1].substream_opened) ||
+ (pcmC0D0c->streams[1].substream_opened && pcmC0D2c->streams[1].substream_opened) ||
+ (pcmC0D0c->streams[1].substream_opened && pcmC0D3c->streams[1].substream_opened) ||
+ (pcmC0D1c->streams[1].substream_opened && pcmC0D2c->streams[1].substream_opened) ||
+ (pcmC0D1c->streams[1].substream_opened && pcmC0D3c->streams[1].substream_opened) ||
+ (pcmC0D2c->streams[1].substream_opened && pcmC0D3c->streams[1].substream_opened))
+ {
+ print_audio("Alsa Entered func %s error busy, pcmC0D0c.opened=%d, pcmC0D1c.opened=%d, pcmC0D2c.opened=%d,pcmC0D3c.opened=%d\n",
+ __func__, pcmC0D0c->streams[1].substream_opened, pcmC0D1c->streams[1].substream_opened,
+ pcmC0D2c->streams[1].substream_opened, pcmC0D3c->streams[1].substream_opened);
+ sc_debug_info_record(MODULE_ID_CAP_AUDIO, "Alsa %s err, opened value pcmC0D0c=%d, pcmC0D1c=%d, pcmC0D2c=%d, pcmC0D3c=%d\n",
+ __func__, pcmC0D0c->streams[1].substream_opened, pcmC0D1c->streams[1].substream_opened,
+ pcmC0D2c->streams[1].substream_opened, pcmC0D3c->streams[1].substream_opened);
+
+ return -EBUSY;
+ //BUG();
+ }
+
#if 0
- unsigned long flags;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
- gpio_set_value(ZX29_GPIO_125, GPIO_LOW);
- mdelay(1);
-
- raw_spin_lock_irqsave(&codec_pa_lock, flags);
- gpio_set_value(ZX29_GPIO_125, GPIO_HIGH);
- udelay(2);
- gpio_set_value(ZX29_GPIO_125, GPIO_LOW);
- udelay(2);
- gpio_set_value(ZX29_GPIO_125, GPIO_HIGH);
- udelay(2);
- gpio_set_value(ZX29_GPIO_125, GPIO_LOW);
- udelay(2);
- gpio_set_value(ZX29_GPIO_125, GPIO_HIGH);
- raw_spin_unlock_irqrestore(&codec_pa_lock, flags);
- }
+ unsigned long flags;
+ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ gpio_set_value(ZX29_GPIO_125, GPIO_LOW);
+ mdelay(1);
+
+ raw_spin_lock_irqsave(&codec_pa_lock, flags);
+ gpio_set_value(ZX29_GPIO_125, GPIO_HIGH);
+ udelay(2);
+ gpio_set_value(ZX29_GPIO_125, GPIO_LOW);
+ udelay(2);
+ gpio_set_value(ZX29_GPIO_125, GPIO_HIGH);
+ udelay(2);
+ gpio_set_value(ZX29_GPIO_125, GPIO_LOW);
+ udelay(2);
+ gpio_set_value(ZX29_GPIO_125, GPIO_HIGH);
+ raw_spin_unlock_irqrestore(&codec_pa_lock, flags);
+ }
#endif
-
- unsigned int armRegBit = 0;
- //armRegBit = zx_read_reg(AON_WIFI_BT_CLK_CFG2);
- //armRegBit &= 0xfffffffe;
- //armRegBit |= 0x1;
- //zx_write_reg(AON_WIFI_BT_CLK_CFG2, armRegBit);
-
- return 0;
- }
+
+ unsigned int armRegBit = 0;
+ //armRegBit = zx_read_reg(AON_WIFI_BT_CLK_CFG2);
+ //armRegBit &= 0xfffffffe;
+ //armRegBit |= 0x1;
+ //zx_write_reg(AON_WIFI_BT_CLK_CFG2, armRegBit);
+
+ return 0;
+}
+/* Ended by AICoder, pid:53525s2951m0dfb1406409962017998611b17cc1 */
static void zx29_shutdown(struct snd_pcm_substream *substream)
{
diff --git a/upstream/linux-5.10/sound/soc/sanechips/zx29_es83xx.c b/upstream/linux-5.10/sound/soc/sanechips/zx29_es83xx.c
index 1204542..0aaf23f 100755
--- a/upstream/linux-5.10/sound/soc/sanechips/zx29_es83xx.c
+++ b/upstream/linux-5.10/sound/soc/sanechips/zx29_es83xx.c
@@ -39,6 +39,7 @@
#include "i2s.h"
+#include "pub_debug_info.h"
#define ZX29_I2S_TOP_LOOP_REG 0x60
//#define NAU_CLK_ID 0
@@ -101,29 +102,97 @@
struct snd_ctl_elem_value *ucontrol);
- static int zx29startup(struct snd_pcm_substream *substream)
- {
- // int ret = 0;
- print_audio("Alsa Entered func %s\n", __func__);
- //CPPS_FUNC(cpps_callbacks, zDrv_Audio_Printf)("Alsa: zx29_startup device=%d,stream=%d\n", substream->pcm->device, substream->stream);
+/* Started by AICoder, pid:i3fd98546erae28145550ba82095535ff4895652 */
+static int zx29startup(struct snd_pcm_substream *substream)
+{
+ //int ret = 0;
+ print_audio("Alsa Entered func %s\n", __func__);
+ //CPPS_FUNC(cpps_callbacks, zDrv_Audio_Printf)("Alsa: zx29_startup device=%d,stream=%d\n", substream->pcm->device, substream->stream);
+
+ struct snd_pcm *pcmC0D0p = snd_lookup_minor_data(16, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
+ struct snd_pcm *pcmC0D1p = snd_lookup_minor_data(17, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
+ struct snd_pcm *pcmC0D2p = snd_lookup_minor_data(18, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
+ struct snd_pcm *pcmC0D3p = snd_lookup_minor_data(19, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
+ //struct snd_pcm *pcmC0D4p = snd_lookup_minor_data(20, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
- struct snd_pcm *pcmC0D0p = snd_lookup_minor_data(16, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
- struct snd_pcm *pcmC0D1p = snd_lookup_minor_data(17, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
- struct snd_pcm *pcmC0D2p = snd_lookup_minor_data(18, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
- struct snd_pcm *pcmC0D3p = snd_lookup_minor_data(19, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
- if ((pcmC0D0p == NULL) || (pcmC0D1p == NULL) || (pcmC0D2p == NULL) || (pcmC0D3p == NULL))
- return -EINVAL;
- if ((pcmC0D0p->streams[0].substream_opened && pcmC0D1p->streams[0].substream_opened) ||
- (pcmC0D0p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) ||
- (pcmC0D0p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) ||
- (pcmC0D1p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) ||
- (pcmC0D1p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) ||
- (pcmC0D2p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened))
- BUG();
+ struct snd_pcm *pcmC0D0c = snd_lookup_minor_data(24, SNDRV_DEVICE_TYPE_PCM_CAPTURE);
+ struct snd_pcm *pcmC0D1c = snd_lookup_minor_data(25, SNDRV_DEVICE_TYPE_PCM_CAPTURE);
+ struct snd_pcm *pcmC0D2c = snd_lookup_minor_data(26, SNDRV_DEVICE_TYPE_PCM_CAPTURE);
+ struct snd_pcm *pcmC0D3c = snd_lookup_minor_data(27, SNDRV_DEVICE_TYPE_PCM_CAPTURE);
+ //struct snd_pcm *pcmC0D4c = snd_lookup_minor_data(28, SNDRV_DEVICE_TYPE_PCM_CAPTURE);
+
+ if ((pcmC0D0p == NULL) || (pcmC0D1p == NULL) || (pcmC0D2p == NULL) || (pcmC0D3p == NULL))
+ {
+ print_audio("Alsa Entered func %s, pcmC0D0p=%p, pcmC0D1p=%p, pcmC0D2p=%p, pcmC0D3p=%p\n", __func__,
+ pcmC0D0p, pcmC0D1p, pcmC0D2p, pcmC0D3p);
+ return -EINVAL;
+ }
+ if ((pcmC0D0p->streams[0].substream_opened && pcmC0D1p->streams[0].substream_opened) ||
+ (pcmC0D0p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) ||
+ (pcmC0D0p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) ||
+ (pcmC0D1p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) ||
+ (pcmC0D1p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) ||
+ (pcmC0D2p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened))
+ {
+ print_audio("Alsa Entered func %s error busy, pcmC0D0p.opened=%d, pcmC0D1p.opened=%d, pcmC0D2p.opened=%d, pcmC0D3p.opened=%d\n",
+ __func__, pcmC0D0p->streams[0].substream_opened, pcmC0D1p->streams[0].substream_opened,
+ pcmC0D2p->streams[0].substream_opened, pcmC0D3p->streams[0].substream_opened);
+ sc_debug_info_record(MODULE_ID_CAP_AUDIO, "Alsa %s err, opened value pcmC0D0p=%d, pcmC0D1p=%d, pcmC0D2p=%d, pcmC0D3p=%d\n",
+ __func__, pcmC0D0p->streams[0].substream_opened, pcmC0D1p->streams[0].substream_opened,
+ pcmC0D2p->streams[0].substream_opened, pcmC0D3p->streams[0].substream_opened);
+
+ return -EBUSY;
+ //BUG();
+ }
+
+ if ((pcmC0D0c == NULL) || (pcmC0D1c == NULL) || (pcmC0D2c == NULL) || (pcmC0D3c == NULL))
+ {
+ print_audio("Alsa Entered func %s, pcmC0D0c=%p, pcmC0D1c=%p, pcmC0D2c=%p, pcmC0D3c=%p\n", __func__,
+ pcmC0D0c, pcmC0D1c, pcmC0D2c, pcmC0D3c);
+ return -EINVAL;
+ }
+ if ((pcmC0D0c->streams[1].substream_opened && pcmC0D1c->streams[1].substream_opened) ||
+ (pcmC0D0c->streams[1].substream_opened && pcmC0D2c->streams[1].substream_opened) ||
+ (pcmC0D0c->streams[1].substream_opened && pcmC0D3c->streams[1].substream_opened) ||
+ (pcmC0D1c->streams[1].substream_opened && pcmC0D2c->streams[1].substream_opened) ||
+ (pcmC0D1c->streams[1].substream_opened && pcmC0D3c->streams[1].substream_opened) ||
+ (pcmC0D2c->streams[1].substream_opened && pcmC0D3c->streams[1].substream_opened))
+ {
+ print_audio("Alsa Entered func %s error busy, pcmC0D0c.opened=%d, pcmC0D1c.opened=%d, pcmC0D2c.opened=%d,pcmC0D3c.opened=%d\n",
+ __func__, pcmC0D0c->streams[1].substream_opened, pcmC0D1c->streams[1].substream_opened,
+ pcmC0D2c->streams[1].substream_opened, pcmC0D3c->streams[1].substream_opened);
+ sc_debug_info_record(MODULE_ID_CAP_AUDIO, "Alsa %s err, opened value pcmC0D0c=%d, pcmC0D1c=%d, pcmC0D2c=%d, pcmC0D3c=%d\n",
+ __func__, pcmC0D0c->streams[1].substream_opened, pcmC0D1c->streams[1].substream_opened,
+ pcmC0D2c->streams[1].substream_opened, pcmC0D3c->streams[1].substream_opened);
+
+ return -EBUSY;
+ //BUG();
+ }
-
- return 0;
- }
+#if 0
+ unsigned long flags;
+ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ gpio_set_value(ZX29_GPIO_125, GPIO_LOW);
+ mdelay(1);
+
+ raw_spin_lock_irqsave(&codec_pa_lock, flags);
+ gpio_set_value(ZX29_GPIO_125, GPIO_HIGH);
+ udelay(2);
+ gpio_set_value(ZX29_GPIO_125, GPIO_LOW);
+ udelay(2);
+ gpio_set_value(ZX29_GPIO_125, GPIO_HIGH);
+ udelay(2);
+ gpio_set_value(ZX29_GPIO_125, GPIO_LOW);
+ udelay(2);
+ gpio_set_value(ZX29_GPIO_125, GPIO_HIGH);
+ raw_spin_unlock_irqrestore(&codec_pa_lock, flags);
+ }
+#endif
+
+
+ return 0;
+}
+/* Ended by AICoder, pid:i3fd98546erae28145550ba82095535ff4895652 */
static void zx29_shutdown(struct snd_pcm_substream *substream)
{
diff --git a/upstream/linux-5.10/sound/soc/sanechips/zx29_max9867.c b/upstream/linux-5.10/sound/soc/sanechips/zx29_max9867.c
index ea874ee..7cb0c36 100755
--- a/upstream/linux-5.10/sound/soc/sanechips/zx29_max9867.c
+++ b/upstream/linux-5.10/sound/soc/sanechips/zx29_max9867.c
@@ -37,6 +37,7 @@
#include "i2s.h"
+#include "pub_debug_info.h"
#define ZX29_I2S_TOP_LOOP_REG 0x60
#define CODEC_CLK_ID 0
@@ -371,48 +372,97 @@
- static int zx29startup(struct snd_pcm_substream *substream)
- {
- // int ret = 0;
- print_audio("Alsa Entered func %s\n", __func__);
- //CPPS_FUNC(cpps_callbacks, zDrv_Audio_Printf)("Alsa: zx29_startup device=%d,stream=%d\n", substream->pcm->device, substream->stream);
+/* Started by AICoder, pid:g33a6vccc4k69881474b0948e0153c719773e1fe */
+static int zx29startup(struct snd_pcm_substream *substream)
+{
+ //int ret = 0;
+ print_audio("Alsa Entered func %s\n", __func__);
+ //CPPS_FUNC(cpps_callbacks, zDrv_Audio_Printf)("Alsa: zx29_startup device=%d,stream=%d\n", substream->pcm->device, substream->stream);
+
+ struct snd_pcm *pcmC0D0p = snd_lookup_minor_data(16, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
+ struct snd_pcm *pcmC0D1p = snd_lookup_minor_data(17, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
+ struct snd_pcm *pcmC0D2p = snd_lookup_minor_data(18, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
+ struct snd_pcm *pcmC0D3p = snd_lookup_minor_data(19, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
+ //struct snd_pcm *pcmC0D4p = snd_lookup_minor_data(20, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
- struct snd_pcm *pcmC0D0p = snd_lookup_minor_data(16, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
- struct snd_pcm *pcmC0D1p = snd_lookup_minor_data(17, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
- struct snd_pcm *pcmC0D2p = snd_lookup_minor_data(18, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
- struct snd_pcm *pcmC0D3p = snd_lookup_minor_data(19, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
- if ((pcmC0D0p == NULL) || (pcmC0D1p == NULL) || (pcmC0D2p == NULL) || (pcmC0D3p == NULL))
- return -EINVAL;
- if ((pcmC0D0p->streams[0].substream_opened && pcmC0D1p->streams[0].substream_opened) ||
- (pcmC0D0p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) ||
- (pcmC0D0p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) ||
- (pcmC0D1p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) ||
- (pcmC0D1p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) ||
- (pcmC0D2p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened))
- BUG();
+ struct snd_pcm *pcmC0D0c = snd_lookup_minor_data(24, SNDRV_DEVICE_TYPE_PCM_CAPTURE);
+ struct snd_pcm *pcmC0D1c = snd_lookup_minor_data(25, SNDRV_DEVICE_TYPE_PCM_CAPTURE);
+ struct snd_pcm *pcmC0D2c = snd_lookup_minor_data(26, SNDRV_DEVICE_TYPE_PCM_CAPTURE);
+ struct snd_pcm *pcmC0D3c = snd_lookup_minor_data(27, SNDRV_DEVICE_TYPE_PCM_CAPTURE);
+ //struct snd_pcm *pcmC0D4c = snd_lookup_minor_data(28, SNDRV_DEVICE_TYPE_PCM_CAPTURE);
+
+ if ((pcmC0D0p == NULL) || (pcmC0D1p == NULL) || (pcmC0D2p == NULL) || (pcmC0D3p == NULL))
+ {
+ print_audio("Alsa Entered func %s, pcmC0D0p=%p, pcmC0D1p=%p, pcmC0D2p=%p, pcmC0D3p=%p\n", __func__,
+ pcmC0D0p, pcmC0D1p, pcmC0D2p, pcmC0D3p);
+ return -EINVAL;
+ }
+ if ((pcmC0D0p->streams[0].substream_opened && pcmC0D1p->streams[0].substream_opened) ||
+ (pcmC0D0p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) ||
+ (pcmC0D0p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) ||
+ (pcmC0D1p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) ||
+ (pcmC0D1p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) ||
+ (pcmC0D2p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened))
+ {
+ print_audio("Alsa Entered func %s error busy, pcmC0D0p.opened=%d, pcmC0D1p.opened=%d, pcmC0D2p.opened=%d, pcmC0D3p.opened=%d\n",
+ __func__, pcmC0D0p->streams[0].substream_opened, pcmC0D1p->streams[0].substream_opened,
+ pcmC0D2p->streams[0].substream_opened, pcmC0D3p->streams[0].substream_opened);
+ sc_debug_info_record(MODULE_ID_CAP_AUDIO, "Alsa %s err, opened value pcmC0D0p=%d, pcmC0D1p=%d, pcmC0D2p=%d, pcmC0D3p=%d\n",
+ __func__, pcmC0D0p->streams[0].substream_opened, pcmC0D1p->streams[0].substream_opened,
+ pcmC0D2p->streams[0].substream_opened, pcmC0D3p->streams[0].substream_opened);
+
+ return -EBUSY;
+ //BUG();
+ }
+
+ if ((pcmC0D0c == NULL) || (pcmC0D1c == NULL) || (pcmC0D2c == NULL) || (pcmC0D3c == NULL))
+ {
+ print_audio("Alsa Entered func %s, pcmC0D0c=%p, pcmC0D1c=%p, pcmC0D2c=%p, pcmC0D3c=%p\n", __func__,
+ pcmC0D0c, pcmC0D1c, pcmC0D2c, pcmC0D3c);
+ return -EINVAL;
+ }
+ if ((pcmC0D0c->streams[1].substream_opened && pcmC0D1c->streams[1].substream_opened) ||
+ (pcmC0D0c->streams[1].substream_opened && pcmC0D2c->streams[1].substream_opened) ||
+ (pcmC0D0c->streams[1].substream_opened && pcmC0D3c->streams[1].substream_opened) ||
+ (pcmC0D1c->streams[1].substream_opened && pcmC0D2c->streams[1].substream_opened) ||
+ (pcmC0D1c->streams[1].substream_opened && pcmC0D3c->streams[1].substream_opened) ||
+ (pcmC0D2c->streams[1].substream_opened && pcmC0D3c->streams[1].substream_opened))
+ {
+ print_audio("Alsa Entered func %s error busy, pcmC0D0c.opened=%d, pcmC0D1c.opened=%d, pcmC0D2c.opened=%d,pcmC0D3c.opened=%d\n",
+ __func__, pcmC0D0c->streams[1].substream_opened, pcmC0D1c->streams[1].substream_opened,
+ pcmC0D2c->streams[1].substream_opened, pcmC0D3c->streams[1].substream_opened);
+ sc_debug_info_record(MODULE_ID_CAP_AUDIO, "Alsa %s err, opened value pcmC0D0c=%d, pcmC0D1c=%d, pcmC0D2c=%d, pcmC0D3c=%d\n",
+ __func__, pcmC0D0c->streams[1].substream_opened, pcmC0D1c->streams[1].substream_opened,
+ pcmC0D2c->streams[1].substream_opened, pcmC0D3c->streams[1].substream_opened;
+
+ return -EBUSY;
+ //BUG();
+ }
+
#if 0
- unsigned long flags;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
- gpio_set_value(ZX29_GPIO_125, GPIO_LOW);
- mdelay(1);
-
- raw_spin_lock_irqsave(&codec_pa_lock, flags);
- gpio_set_value(ZX29_GPIO_125, GPIO_HIGH);
- udelay(2);
- gpio_set_value(ZX29_GPIO_125, GPIO_LOW);
- udelay(2);
- gpio_set_value(ZX29_GPIO_125, GPIO_HIGH);
- udelay(2);
- gpio_set_value(ZX29_GPIO_125, GPIO_LOW);
- udelay(2);
- gpio_set_value(ZX29_GPIO_125, GPIO_HIGH);
- raw_spin_unlock_irqrestore(&codec_pa_lock, flags);
- }
+ unsigned long flags;
+ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ gpio_set_value(ZX29_GPIO_125, GPIO_LOW);
+ mdelay(1);
+
+ raw_spin_lock_irqsave(&codec_pa_lock, flags);
+ gpio_set_value(ZX29_GPIO_125, GPIO_HIGH);
+ udelay(2);
+ gpio_set_value(ZX29_GPIO_125, GPIO_LOW);
+ udelay(2);
+ gpio_set_value(ZX29_GPIO_125, GPIO_HIGH);
+ udelay(2);
+ gpio_set_value(ZX29_GPIO_125, GPIO_LOW);
+ udelay(2);
+ gpio_set_value(ZX29_GPIO_125, GPIO_HIGH);
+ raw_spin_unlock_irqrestore(&codec_pa_lock, flags);
+ }
#endif
-
-
- return 0;
- }
+
+
+ return 0;
+}
+/* Ended by AICoder, pid:g33a6vccc4k69881474b0948e0153c719773e1fe */
static void zx29_shutdown(struct snd_pcm_substream *substream)
{
diff --git a/upstream/linux-5.10/sound/soc/sanechips/zx29_nau8810.c b/upstream/linux-5.10/sound/soc/sanechips/zx29_nau8810.c
index 1e5777d..4dc8672 100755
--- a/upstream/linux-5.10/sound/soc/sanechips/zx29_nau8810.c
+++ b/upstream/linux-5.10/sound/soc/sanechips/zx29_nau8810.c
@@ -37,6 +37,7 @@
#include "i2s.h"
+#include "pub_debug_info.h"
#define ZX29_I2S_TOP_LOOP_REG 0x60
#define NAU_CLK_ID 0
@@ -373,48 +374,97 @@
- static int zx29startup(struct snd_pcm_substream *substream)
- {
- // int ret = 0;
- print_audio("Alsa Entered func %s\n", __func__);
- //CPPS_FUNC(cpps_callbacks, zDrv_Audio_Printf)("Alsa: zx29_startup device=%d,stream=%d\n", substream->pcm->device, substream->stream);
+/* Started by AICoder, pid:we8d34d80fbc7981449d0b1590d6b753b789d779 */
+static int zx29startup(struct snd_pcm_substream *substream)
+{
+ //int ret = 0;
+ print_audio("Alsa Entered func %s\n", __func__);
+ //CPPS_FUNC(cpps_callbacks, zDrv_Audio_Printf)("Alsa: zx29_startup device=%d,stream=%d\n", substream->pcm->device, substream->stream);
+
+ struct snd_pcm *pcmC0D0p = snd_lookup_minor_data(16, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
+ struct snd_pcm *pcmC0D1p = snd_lookup_minor_data(17, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
+ struct snd_pcm *pcmC0D2p = snd_lookup_minor_data(18, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
+ struct snd_pcm *pcmC0D3p = snd_lookup_minor_data(19, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
+ //struct snd_pcm *pcmC0D4p = snd_lookup_minor_data(20, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
- struct snd_pcm *pcmC0D0p = snd_lookup_minor_data(16, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
- struct snd_pcm *pcmC0D1p = snd_lookup_minor_data(17, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
- struct snd_pcm *pcmC0D2p = snd_lookup_minor_data(18, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
- struct snd_pcm *pcmC0D3p = snd_lookup_minor_data(19, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
- if ((pcmC0D0p == NULL) || (pcmC0D1p == NULL) || (pcmC0D2p == NULL) || (pcmC0D3p == NULL))
- return -EINVAL;
- if ((pcmC0D0p->streams[0].substream_opened && pcmC0D1p->streams[0].substream_opened) ||
- (pcmC0D0p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) ||
- (pcmC0D0p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) ||
- (pcmC0D1p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) ||
- (pcmC0D1p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) ||
- (pcmC0D2p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened))
- BUG();
+ struct snd_pcm *pcmC0D0c = snd_lookup_minor_data(24, SNDRV_DEVICE_TYPE_PCM_CAPTURE);
+ struct snd_pcm *pcmC0D1c = snd_lookup_minor_data(25, SNDRV_DEVICE_TYPE_PCM_CAPTURE);
+ struct snd_pcm *pcmC0D2c = snd_lookup_minor_data(26, SNDRV_DEVICE_TYPE_PCM_CAPTURE);
+ struct snd_pcm *pcmC0D3c = snd_lookup_minor_data(27, SNDRV_DEVICE_TYPE_PCM_CAPTURE);
+ //struct snd_pcm *pcmC0D4c = snd_lookup_minor_data(28, SNDRV_DEVICE_TYPE_PCM_CAPTURE);
+
+ if ((pcmC0D0p == NULL) || (pcmC0D1p == NULL) || (pcmC0D2p == NULL) || (pcmC0D3p == NULL))
+ {
+ print_audio("Alsa Entered func %s, pcmC0D0p=%p, pcmC0D1p=%p, pcmC0D2p=%p, pcmC0D3p=%p\n", __func__,
+ pcmC0D0p, pcmC0D1p, pcmC0D2p, pcmC0D3p);
+ return -EINVAL;
+ }
+ if ((pcmC0D0p->streams[0].substream_opened && pcmC0D1p->streams[0].substream_opened) ||
+ (pcmC0D0p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) ||
+ (pcmC0D0p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) ||
+ (pcmC0D1p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) ||
+ (pcmC0D1p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) ||
+ (pcmC0D2p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened))
+ {
+ print_audio("Alsa Entered func %s error busy, pcmC0D0p.opened=%d, pcmC0D1p.opened=%d, pcmC0D2p.opened=%d, pcmC0D3p.opened=%d\n",
+ __func__, pcmC0D0p->streams[0].substream_opened, pcmC0D1p->streams[0].substream_opened,
+ pcmC0D2p->streams[0].substream_opened, pcmC0D3p->streams[0].substream_opened);
+ sc_debug_info_record(MODULE_ID_CAP_AUDIO, "Alsa %s err, opened value pcmC0D0p=%d, pcmC0D1p=%d, pcmC0D2p=%d, pcmC0D3p=%d\n",
+ __func__, pcmC0D0p->streams[0].substream_opened, pcmC0D1p->streams[0].substream_opened,
+ pcmC0D2p->streams[0].substream_opened, pcmC0D3p->streams[0].substream_opened);
+
+ return -EBUSY;
+ //BUG();
+ }
+
+ if ((pcmC0D0c == NULL) || (pcmC0D1c == NULL) || (pcmC0D2c == NULL) || (pcmC0D3c == NULL))
+ {
+ print_audio("Alsa Entered func %s, pcmC0D0c=%p, pcmC0D1c=%p, pcmC0D2c=%p, pcmC0D3c=%p\n", __func__,
+ pcmC0D0c, pcmC0D1c, pcmC0D2c, pcmC0D3c);
+ return -EINVAL;
+ }
+ if ((pcmC0D0c->streams[1].substream_opened && pcmC0D1c->streams[1].substream_opened) ||
+ (pcmC0D0c->streams[1].substream_opened && pcmC0D2c->streams[1].substream_opened) ||
+ (pcmC0D0c->streams[1].substream_opened && pcmC0D3c->streams[1].substream_opened) ||
+ (pcmC0D1c->streams[1].substream_opened && pcmC0D2c->streams[1].substream_opened) ||
+ (pcmC0D1c->streams[1].substream_opened && pcmC0D3c->streams[1].substream_opened) ||
+ (pcmC0D2c->streams[1].substream_opened && pcmC0D3c->streams[1].substream_opened))
+ {
+ print_audio("Alsa Entered func %s error busy, pcmC0D0c.opened=%d, pcmC0D1c.opened=%d, pcmC0D2c.opened=%d,pcmC0D3c.opened=%d\n",
+ __func__, pcmC0D0c->streams[1].substream_opened, pcmC0D1c->streams[1].substream_opened,
+ pcmC0D2c->streams[1].substream_opened, pcmC0D3c->streams[1].substream_opened);
+ sc_debug_info_record(MODULE_ID_CAP_AUDIO, "Alsa %s err, opened value pcmC0D0c=%d, pcmC0D1c=%d, pcmC0D2c=%d, pcmC0D3c=%d\n",
+ __func__, pcmC0D0c->streams[1].substream_opened, pcmC0D1c->streams[1].substream_opened,
+ pcmC0D2c->streams[1].substream_opened, pcmC0D3c->streams[1].substream_opened);
+
+ return -EBUSY;
+ //BUG();
+ }
+
#if 0
- unsigned long flags;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
- gpio_set_value(ZX29_GPIO_125, GPIO_LOW);
- mdelay(1);
-
- raw_spin_lock_irqsave(&codec_pa_lock, flags);
- gpio_set_value(ZX29_GPIO_125, GPIO_HIGH);
- udelay(2);
- gpio_set_value(ZX29_GPIO_125, GPIO_LOW);
- udelay(2);
- gpio_set_value(ZX29_GPIO_125, GPIO_HIGH);
- udelay(2);
- gpio_set_value(ZX29_GPIO_125, GPIO_LOW);
- udelay(2);
- gpio_set_value(ZX29_GPIO_125, GPIO_HIGH);
- raw_spin_unlock_irqrestore(&codec_pa_lock, flags);
- }
+ unsigned long flags;
+ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ gpio_set_value(ZX29_GPIO_125, GPIO_LOW);
+ mdelay(1);
+
+ raw_spin_lock_irqsave(&codec_pa_lock, flags);
+ gpio_set_value(ZX29_GPIO_125, GPIO_HIGH);
+ udelay(2);
+ gpio_set_value(ZX29_GPIO_125, GPIO_LOW);
+ udelay(2);
+ gpio_set_value(ZX29_GPIO_125, GPIO_HIGH);
+ udelay(2);
+ gpio_set_value(ZX29_GPIO_125, GPIO_LOW);
+ udelay(2);
+ gpio_set_value(ZX29_GPIO_125, GPIO_HIGH);
+ raw_spin_unlock_irqrestore(&codec_pa_lock, flags);
+ }
#endif
-
-
- return 0;
- }
+
+
+ return 0;
+}
+/* Ended by AICoder, pid:we8d34d80fbc7981449d0b1590d6b753b789d779 */
static void zx29_shutdown(struct snd_pcm_substream *substream)
{
diff --git a/upstream/linux-5.10/sound/soc/sanechips/zx29_ti3100.c b/upstream/linux-5.10/sound/soc/sanechips/zx29_ti3100.c
index 9959350..3b9bedf 100755
--- a/upstream/linux-5.10/sound/soc/sanechips/zx29_ti3100.c
+++ b/upstream/linux-5.10/sound/soc/sanechips/zx29_ti3100.c
@@ -37,6 +37,7 @@
#include "i2s.h"
+#include "pub_debug_info.h"
#define ZX29_I2S_TOP_LOOP_REG 0x60
@@ -370,48 +371,97 @@
- static int zx29startup(struct snd_pcm_substream *substream)
- {
- // int ret = 0;
- print_audio("Alsa Entered func %s\n", __func__);
- //CPPS_FUNC(cpps_callbacks, zDrv_Audio_Printf)("Alsa: zx29_startup device=%d,stream=%d\n", substream->pcm->device, substream->stream);
+/* Started by AICoder, pid:cd752b8f85qb5fa14ec60aceb0c11d619783bee6 */
+static int zx29startup(struct snd_pcm_substream *substream)
+{
+ //int ret = 0;
+ print_audio("Alsa Entered func %s\n", __func__);
+ //CPPS_FUNC(cpps_callbacks, zDrv_Audio_Printf)("Alsa: zx29_startup device=%d,stream=%d\n", substream->pcm->device, substream->stream);
+
+ struct snd_pcm *pcmC0D0p = snd_lookup_minor_data(16, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
+ struct snd_pcm *pcmC0D1p = snd_lookup_minor_data(17, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
+ struct snd_pcm *pcmC0D2p = snd_lookup_minor_data(18, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
+ struct snd_pcm *pcmC0D3p = snd_lookup_minor_data(19, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
+ //struct snd_pcm *pcmC0D4p = snd_lookup_minor_data(20, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
- struct snd_pcm *pcmC0D0p = snd_lookup_minor_data(16, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
- struct snd_pcm *pcmC0D1p = snd_lookup_minor_data(17, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
- struct snd_pcm *pcmC0D2p = snd_lookup_minor_data(18, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
- struct snd_pcm *pcmC0D3p = snd_lookup_minor_data(19, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
- if ((pcmC0D0p == NULL) || (pcmC0D1p == NULL) || (pcmC0D2p == NULL) || (pcmC0D3p == NULL))
- return -EINVAL;
- if ((pcmC0D0p->streams[0].substream_opened && pcmC0D1p->streams[0].substream_opened) ||
- (pcmC0D0p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) ||
- (pcmC0D0p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) ||
- (pcmC0D1p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) ||
- (pcmC0D1p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) ||
- (pcmC0D2p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened))
- BUG();
+ struct snd_pcm *pcmC0D0c = snd_lookup_minor_data(24, SNDRV_DEVICE_TYPE_PCM_CAPTURE);
+ struct snd_pcm *pcmC0D1c = snd_lookup_minor_data(25, SNDRV_DEVICE_TYPE_PCM_CAPTURE);
+ struct snd_pcm *pcmC0D2c = snd_lookup_minor_data(26, SNDRV_DEVICE_TYPE_PCM_CAPTURE);
+ struct snd_pcm *pcmC0D3c = snd_lookup_minor_data(27, SNDRV_DEVICE_TYPE_PCM_CAPTURE);
+ //struct snd_pcm *pcmC0D4c = snd_lookup_minor_data(28, SNDRV_DEVICE_TYPE_PCM_CAPTURE);
+
+ if ((pcmC0D0p == NULL) || (pcmC0D1p == NULL) || (pcmC0D2p == NULL) || (pcmC0D3p == NULL))
+ {
+ print_audio("Alsa Entered func %s, pcmC0D0p=%p, pcmC0D1p=%p, pcmC0D2p=%p, pcmC0D3p=%p\n", __func__,
+ pcmC0D0p, pcmC0D1p, pcmC0D2p, pcmC0D3p);
+ return -EINVAL;
+ }
+ if ((pcmC0D0p->streams[0].substream_opened && pcmC0D1p->streams[0].substream_opened) ||
+ (pcmC0D0p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) ||
+ (pcmC0D0p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) ||
+ (pcmC0D1p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) ||
+ (pcmC0D1p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) ||
+ (pcmC0D2p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened))
+ {
+ print_audio("Alsa Entered func %s error busy, pcmC0D0p.opened=%d, pcmC0D1p.opened=%d, pcmC0D2p.opened=%d, pcmC0D3p.opened=%d\n",
+ __func__, pcmC0D0p->streams[0].substream_opened, pcmC0D1p->streams[0].substream_opened,
+ pcmC0D2p->streams[0].substream_opened, pcmC0D3p->streams[0].substream_opened);
+ sc_debug_info_record(MODULE_ID_CAP_AUDIO, "Alsa %s err, opened value pcmC0D0p=%d, pcmC0D1p=%d, pcmC0D2p=%d, pcmC0D3p=%d\n",
+ __func__, pcmC0D0p->streams[0].substream_opened, pcmC0D1p->streams[0].substream_opened,
+ pcmC0D2p->streams[0].substream_opened, pcmC0D3p->streams[0].substream_opened);
+
+ return -EBUSY;
+ //BUG();
+ }
+
+ if ((pcmC0D0c == NULL) || (pcmC0D1c == NULL) || (pcmC0D2c == NULL) || (pcmC0D3c == NULL))
+ {
+ print_audio("Alsa Entered func %s, pcmC0D0c=%p, pcmC0D1c=%p, pcmC0D2c=%p, pcmC0D3c=%p\n", __func__,
+ pcmC0D0c, pcmC0D1c, pcmC0D2c, pcmC0D3c);
+ return -EINVAL;
+ }
+ if ((pcmC0D0c->streams[1].substream_opened && pcmC0D1c->streams[1].substream_opened) ||
+ (pcmC0D0c->streams[1].substream_opened && pcmC0D2c->streams[1].substream_opened) ||
+ (pcmC0D0c->streams[1].substream_opened && pcmC0D3c->streams[1].substream_opened) ||
+ (pcmC0D1c->streams[1].substream_opened && pcmC0D2c->streams[1].substream_opened) ||
+ (pcmC0D1c->streams[1].substream_opened && pcmC0D3c->streams[1].substream_opened) ||
+ (pcmC0D2c->streams[1].substream_opened && pcmC0D3c->streams[1].substream_opened))
+ {
+ print_audio("Alsa Entered func %s error busy, pcmC0D0c.opened=%d, pcmC0D1c.opened=%d, pcmC0D2c.opened=%d,pcmC0D3c.opened=%d\n",
+ __func__, pcmC0D0c->streams[1].substream_opened, pcmC0D1c->streams[1].substream_opened,
+ pcmC0D2c->streams[1].substream_opened, pcmC0D3c->streams[1].substream_opened);
+ sc_debug_info_record(MODULE_ID_CAP_AUDIO, "Alsa %s err, opened value pcmC0D0c=%d, pcmC0D1c=%d, pcmC0D2c=%d, pcmC0D3c=%d\n",
+ __func__, pcmC0D0c->streams[1].substream_opened, pcmC0D1c->streams[1].substream_opened,
+ pcmC0D2c->streams[1].substream_opened, pcmC0D3c->streams[1].substream_opened);
+
+ return -EBUSY;
+ //BUG();
+ }
+
#if 0
- unsigned long flags;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
- gpio_set_value(ZX29_GPIO_125, GPIO_LOW);
- mdelay(1);
-
- raw_spin_lock_irqsave(&codec_pa_lock, flags);
- gpio_set_value(ZX29_GPIO_125, GPIO_HIGH);
- udelay(2);
- gpio_set_value(ZX29_GPIO_125, GPIO_LOW);
- udelay(2);
- gpio_set_value(ZX29_GPIO_125, GPIO_HIGH);
- udelay(2);
- gpio_set_value(ZX29_GPIO_125, GPIO_LOW);
- udelay(2);
- gpio_set_value(ZX29_GPIO_125, GPIO_HIGH);
- raw_spin_unlock_irqrestore(&codec_pa_lock, flags);
- }
+ unsigned long flags;
+ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ gpio_set_value(ZX29_GPIO_125, GPIO_LOW);
+ mdelay(1);
+
+ raw_spin_lock_irqsave(&codec_pa_lock, flags);
+ gpio_set_value(ZX29_GPIO_125, GPIO_HIGH);
+ udelay(2);
+ gpio_set_value(ZX29_GPIO_125, GPIO_LOW);
+ udelay(2);
+ gpio_set_value(ZX29_GPIO_125, GPIO_HIGH);
+ udelay(2);
+ gpio_set_value(ZX29_GPIO_125, GPIO_LOW);
+ udelay(2);
+ gpio_set_value(ZX29_GPIO_125, GPIO_HIGH);
+ raw_spin_unlock_irqrestore(&codec_pa_lock, flags);
+ }
#endif
-
-
- return 0;
- }
+
+
+ return 0;
+}
+/* Ended by AICoder, pid:cd752b8f85qb5fa14ec60aceb0c11d619783bee6 */
static void zx29_shutdown(struct snd_pcm_substream *substream)
{
diff --git a/upstream/pub/include/infra/pub_debug_info.h b/upstream/pub/include/infra/pub_debug_info.h
index 95a480f..1ee2f88 100755
--- a/upstream/pub/include/infra/pub_debug_info.h
+++ b/upstream/pub/include/infra/pub_debug_info.h
@@ -36,6 +36,10 @@
#define MODULE_ID_CAP_FOTA ("cap_fota")
#define MODULE_ID_CAP_FS_CHECK ("cap_fs_check")
+
+#define MODULE_ID_PS_AUDIO ("ps_audio")
+#define MODULE_ID_AP_AUDIO ("ap_audio")
+#define MODULE_ID_CAP_AUDIO ("cap_audio")
#if defined(_USE_ZXIC_DEBUG_INFO)
int sc_debug_info_vrecord(char *id, const char *format, va_list args);
diff --git a/upstream/pub/include/ps_phy/atipsevent.h b/upstream/pub/include/ps_phy/atipsevent.h
index 92e71e6..adc2b63 100755
--- a/upstream/pub/include/ps_phy/atipsevent.h
+++ b/upstream/pub/include/ps_phy/atipsevent.h
@@ -952,6 +952,7 @@
#define MMIA_UMM_FAST_FREQ_SCAN_REQ_EV (DWORD)(MMIA_UMM_EVENT_BASE + 35)
#define MMIA_UMM_IMSAIRREL_REQ_EV (DWORD)(MMIA_UMM_EVENT_BASE + 36)
#define MMIA_UMM_SOFTPOWER_STATUS_IND_EV (DWORD)(MMIA_UMM_EVENT_BASE + 37)
+#define MMIA_UMM_IMS_CALL_REQ_EV (DWORD)(MMIA_UMM_EVENT_BASE + 38)
#define MMIA_UMM_PLMN_INFO_IND_EV (DWORD)(MMIA_UMM_RSP_EVENT + 0)
@@ -1012,6 +1013,7 @@
#define MMIA_CC_T9TIMER_QRY_REQ_EV (DWORD)(MMIA_CC_EVENT_BASE + 18)
#define MMIA_CC_VOICEMODE_QRY_REQ_EV (DWORD)(MMIA_CC_EVENT_BASE + 19)
#define MMIA_CC_RESETIVS_REQ_EV (DWORD)(MMIA_CC_EVENT_BASE + 20)
+#define MMIA_CC_WAITMSD_QRY_REQ_EV (DWORD)(MMIA_CC_EVENT_BASE + 21)
#define MMIA_CC_MOC_CNF_EV (DWORD)(MMIA_CC_RSP_EVENT + 0)
#define MMIA_CC_MTC_IND_EV (DWORD)(MMIA_CC_RSP_EVENT + 1)
@@ -1048,6 +1050,7 @@
#define MMIA_CC_CALLBACK_EVENT_EV (DWORD)(MMIA_CC_RSP_EVENT + 32)
#define MMIA_CC_VOICEMODE_QRY_CNF_EV (DWORD)(MMIA_CC_RSP_EVENT + 33)
#define MMIA_CC_RESETIVS_CNF_EV (DWORD)(MMIA_CC_RSP_EVENT + 34)
+#define MMIA_CC_WAITMSD_QRY_CNF_EV (DWORD)(MMIA_CC_RSP_EVENT + 35)
/* ========================================================================
MMIA£SMSÏûÏ¢ºÅ¶¨Òå
diff --git a/upstream/pub/include/ps_phy/psevent.h b/upstream/pub/include/ps_phy/psevent.h
index d1fbdf8..4a1897b 100755
--- a/upstream/pub/include/ps_phy/psevent.h
+++ b/upstream/pub/include/ps_phy/psevent.h
@@ -1588,6 +1588,7 @@
#define IVS_CC_MSD_STATE_IND_EV (DWORD)(CM_MM_EVENT_BASE + 25)
#define PSAP_UL_PCM_IND_EV (DWORD)(CM_MM_EVENT_BASE + 26)
+#define CC_UMM_ECALL_EVENT_IND_EV (DWORD)(CM_MM_EVENT_BASE + 27)
/* ========================================================================
UMM£MM/GMM/EMMÏûÏ¢ºÅ¶¨Òå
@@ -4000,6 +4001,7 @@
/*ESM->UMM*/
#define ESM_UMM_DETACH_REQ_EV (DWORD)(ESM_UMM_EVENT_BASE + 0) /*Modified:KangShuJie*/
#define ESM_UMM_LOCAL_DEACT_IND_EV (DWORD)(ESM_UMM_EVENT_BASE + 1)
+#define ESM_UMM_EMERPDN_DEACT_IND_EV (DWORD)(ESM_UMM_EVENT_BASE + 2)
/* ========================================================================
SMºÍESMÄ£¿é¼äÏûÏ¢ºÅ¶¨Òå