Qualcomm platform adsp sensor driver logs need to be captured using QXDM, sensor init is the log information initialized by sensor, at this time QXDM has not recognized the diag port, can not be directly obtained.
Qualcomm supports the following two ways to get sensor init log on adsp side.
The first way is to restart sensors through adb fame and fortune
a. adb shell stop sensors
b. adb shell "echo 'related' > /sys/bus/msm_subsys/devices/subsys1/restart_level"
c. adb shell "echo 'restart' >
/sys/kernel/debug/msm_subsys/adsp"
d. adb shell start sensors
PS: There are two points for attention here:
1. We need to confirm whether / sys/bus/msm_subsys/devices/subsys1 is directed to ADSP or something else. Specific methods are as follows: cat /sys/bus/msm_subsys/devices/subsys1/name return value is adsp, if not cat other subsys*
2. Check whether / sys/kernel/debug/msm_subsys/adsp exists. Qualcomm recently cancelled the msm_subsys/adsp node in subsystem_restart.c. To solve this problem, it needs to import the path shown below.
diff --git a/drivers/soc/qcom/subsystem_restart.c b/drivers/soc/qcom/subsystem_restart.c old mode 100644 new mode 100755 index ea94456..27eb26e --- a/drivers/soc/qcom/subsystem_restart.c +++ b/drivers/soc/qcom/subsystem_restart.c @@ -36,7 +36,7 @@ #include <soc/qcom/subsystem_notif.h> #include <soc/qcom/sysmon.h> #include <trace/events/trace_msm_pil_event.h> - +#include <linux/debugfs.h> #include <asm/current.h> #include "peripheral-loader.h" @@ -178,6 +178,10 @@ struct subsys_device { enum crash_status crashed; int notif_state; struct list_head list; +#ifdef CONFIG_DEBUG_FS + struct dentry *dentry; +#endif + }; static struct subsys_device *to_subsys(struct device *d) @@ -356,11 +360,11 @@ static struct device_attribute subsys_attrs[] = { __ATTR_NULL, }; -struct bus_type subsys_bus_type = { +static struct bus_type subsys_bus_type = { .name = "msm_subsys", .dev_attrs = subsys_attrs, }; -EXPORT_SYMBOL(subsys_bus_type); + static DEFINE_IDA(subsys_ida); @@ -1229,6 +1233,87 @@ void notify_proxy_unvote(struct device *device) notify_each_subsys_device(&dev, 1, SUBSYS_PROXY_UNVOTE, NULL); } +#ifdef CONFIG_DEBUG_FS +static ssize_t subsys_debugfs_read(struct file *filp, char __user *ubuf, + size_t cnt, loff_t *ppos) +{ + int r; + char buf[40]; + struct subsys_device *subsys = filp->private_data; + + r = snprintf(buf, sizeof(buf), "%d\n", subsys->count); + return simple_read_from_buffer(ubuf, cnt, ppos, buf, r); +} + +static ssize_t subsys_debugfs_write(struct file *filp, + const char __user *ubuf, size_t cnt, loff_t *ppos) +{ + struct subsys_device *subsys = filp->private_data; + char buf[10]; + char *cmp; + + cnt = min(cnt, sizeof(buf) - 1); + if (copy_from_user(&buf, ubuf, cnt)) + return -EFAULT; + buf[cnt] = '\0'; + cmp = strstrip(buf); + + if (!strcmp(cmp, "restart")) { + if (subsystem_restart_dev(subsys)) + return -EIO; + } else if (!strcmp(cmp, "get")) { + if (subsystem_get(subsys->desc->name)) + return -EIO; + } else if (!strcmp(cmp, "put")) { + subsystem_put(subsys); + } else { + return -EINVAL; + } + + return cnt; +} + +static const struct file_operations subsys_debugfs_fops = { + .open = simple_open, + .read = subsys_debugfs_read, + .write = subsys_debugfs_write, +}; + +static struct dentry *subsys_base_dir; + +static int __init subsys_debugfs_init(void) +{ + subsys_base_dir = debugfs_create_dir("msm_subsys", NULL); + return !subsys_base_dir ? -ENOMEM : 0; +} + +static void subsys_debugfs_exit(void) +{ + debugfs_remove_recursive(subsys_base_dir); +} + +static int subsys_debugfs_add(struct subsys_device *subsys) +{ + if (!subsys_base_dir) + return -ENOMEM; + + subsys->dentry = debugfs_create_file(subsys->desc->name, + S_IRUGO | S_IWUSR, subsys_base_dir, + subsys, &subsys_debugfs_fops); + return !subsys->dentry ? -ENOMEM : 0; +} + +static void subsys_debugfs_remove(struct subsys_device *subsys) +{ + debugfs_remove(subsys->dentry); +} +#else +static int __init subsys_debugfs_init(void) { return 0; }; +static void subsys_debugfs_exit(void) { } +static int subsys_debugfs_add(struct subsys_device *subsys) { return 0; } +static void subsys_debugfs_remove(struct subsys_device *subsys) { } +#endif + static int subsys_device_open(struct inode *inode, struct file *file) { struct subsys_device *device, *subsys_dev = 0; @@ -1668,8 +1753,18 @@ struct subsys_device *subsys_register(struct subsys_desc *desc) mutex_init(&subsys->track.lock); + ret = subsys_debugfs_add(subsys); + if (ret) { + ida_simple_remove(&subsys_ida, subsys->id); + wakeup_source_trash(&subsys->ssr_wlock); + kfree(subsys); + return ERR_PTR(ret); + } + + ret = device_register(&subsys->dev); if (ret) { + subsys_debugfs_remove(subsys); put_device(&subsys->dev); return ERR_PTR(ret); } @@ -1731,6 +1826,7 @@ err_setup_irqs: if (ofnode) subsys_remove_restart_order(ofnode); err_register: +subsys_debugfs_remove(subsys); device_unregister(&subsys->dev); return ERR_PTR(ret); } @@ -1759,6 +1855,7 @@ void subsys_unregister(struct subsys_device *subsys) WARN_ON(subsys->count); device_unregister(&subsys->dev); mutex_unlock(&subsys->track.lock); + subsys_debugfs_remove(subsys); subsys_char_device_remove(subsys); sysmon_notifier_unregister(subsys->desc); if (subsys->desc->edge) @@ -1799,6 +1896,10 @@ static int __init subsys_restart_init(void) if (ret) goto err_bus; + ret = subsys_debugfs_init(); + if (ret) + goto err_debugfs; + char_class = class_create(THIS_MODULE, "subsys"); if (IS_ERR(char_class)) { ret = -ENOMEM; @@ -1816,6 +1917,8 @@ static int __init subsys_restart_init(void) err_soc: class_destroy(char_class); err_class: + subsys_debugfs_exit(); +err_debugfs: bus_unregister(&subsys_bus_type); err_bus: destroy_workqueue(ssr_wq); diff --git a/include/soc/qcom/subsystem_restart.h b/include/soc/qcom/subsystem_restart.h old mode 100644 new mode 100755 index 9a4d013..da258d2 --- a/include/soc/qcom/subsystem_restart.h +++ b/include/soc/qcom/subsystem_restart.h @@ -18,7 +18,7 @@ #include <linux/interrupt.h> struct subsys_device; -extern struct bus_type subsys_bus_type; +//extern struct bus_type subsys_bus_type; enum { RESET_SOC = 0,
The second way is to add delay when sensor init on adsp side, increase the delay of SMGR_DELAY_US, so as to realize the sensor init operation until QXDM recognizes to the diag port.
If ADSP SSR can not work, you can add delay in the sensor init code (it is just for debug ADSP init issue, need remove it after finish debug); sns_smgr_main.c void sns_smgr_task(void* p_arg) { smgr_init(); sns_smgr_sensor_init(); sns_init_done(); sns_smgr_mr_init(sns_smgr.sig_grp); **SMGR_DELAY_US(6000000);** // This side is delayed for 6 seconds, modify the delayed capture log as needed.