Loading dsp/adsp-loader.c +49 −0 Original line number Diff line number Diff line Loading @@ -26,12 +26,17 @@ #define Q6_PIL_GET_DELAY_MS 100 #define BOOT_CMD 1 #define SSR_RESET_CMD 1 #define IMAGE_UNLOAD_CMD 0 static ssize_t adsp_boot_store(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, size_t count); static ssize_t adsp_ssr_store(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, size_t count); struct adsp_loader_private { void *pil_h; struct kobject *boot_adsp_obj; Loading @@ -41,8 +46,12 @@ struct adsp_loader_private { static struct kobj_attribute adsp_boot_attribute = __ATTR(boot, 0220, NULL, adsp_boot_store); static struct kobj_attribute adsp_ssr_attribute = __ATTR(ssr, 0220, NULL, adsp_ssr_store); static struct attribute *attrs[] = { &adsp_boot_attribute.attr, &adsp_ssr_attribute.attr, NULL, }; Loading Loading @@ -151,6 +160,46 @@ static void adsp_loader_do(struct platform_device *pdev) schedule_work(&adsp_ldr_work); } static ssize_t adsp_ssr_store(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, size_t count) { int ssr_command = 0; struct subsys_device *adsp_dev = NULL; struct platform_device *pdev = adsp_private; struct adsp_loader_private *priv = NULL; int rc; dev_dbg(&pdev->dev, "%s: going to call adsp ssr\n ", __func__); if (kstrtoint(buf, 10, &ssr_command) < 0) return -EINVAL; if (ssr_command != SSR_RESET_CMD) return -EINVAL; priv = platform_get_drvdata(pdev); if (!priv) return -EINVAL; adsp_dev = (struct subsys_device *)priv->pil_h; if (!adsp_dev) return -EINVAL; dev_err(&pdev->dev, "requesting for ADSP restart\n"); /* subsystem_restart_dev has worker queue to handle */ rc = subsystem_restart_dev(adsp_dev); if (rc) { dev_err(&pdev->dev, "subsystem_restart_dev failed\n"); return rc; } dev_dbg(&pdev->dev, "ADSP restarted\n"); return count; } static ssize_t adsp_boot_store(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, Loading Loading
dsp/adsp-loader.c +49 −0 Original line number Diff line number Diff line Loading @@ -26,12 +26,17 @@ #define Q6_PIL_GET_DELAY_MS 100 #define BOOT_CMD 1 #define SSR_RESET_CMD 1 #define IMAGE_UNLOAD_CMD 0 static ssize_t adsp_boot_store(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, size_t count); static ssize_t adsp_ssr_store(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, size_t count); struct adsp_loader_private { void *pil_h; struct kobject *boot_adsp_obj; Loading @@ -41,8 +46,12 @@ struct adsp_loader_private { static struct kobj_attribute adsp_boot_attribute = __ATTR(boot, 0220, NULL, adsp_boot_store); static struct kobj_attribute adsp_ssr_attribute = __ATTR(ssr, 0220, NULL, adsp_ssr_store); static struct attribute *attrs[] = { &adsp_boot_attribute.attr, &adsp_ssr_attribute.attr, NULL, }; Loading Loading @@ -151,6 +160,46 @@ static void adsp_loader_do(struct platform_device *pdev) schedule_work(&adsp_ldr_work); } static ssize_t adsp_ssr_store(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, size_t count) { int ssr_command = 0; struct subsys_device *adsp_dev = NULL; struct platform_device *pdev = adsp_private; struct adsp_loader_private *priv = NULL; int rc; dev_dbg(&pdev->dev, "%s: going to call adsp ssr\n ", __func__); if (kstrtoint(buf, 10, &ssr_command) < 0) return -EINVAL; if (ssr_command != SSR_RESET_CMD) return -EINVAL; priv = platform_get_drvdata(pdev); if (!priv) return -EINVAL; adsp_dev = (struct subsys_device *)priv->pil_h; if (!adsp_dev) return -EINVAL; dev_err(&pdev->dev, "requesting for ADSP restart\n"); /* subsystem_restart_dev has worker queue to handle */ rc = subsystem_restart_dev(adsp_dev); if (rc) { dev_err(&pdev->dev, "subsystem_restart_dev failed\n"); return rc; } dev_dbg(&pdev->dev, "ADSP restarted\n"); return count; } static ssize_t adsp_boot_store(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, Loading