Loading drivers/media/platform/msm/npu/npu_dev.c +1 −1 Original line number Original line Diff line number Diff line Loading @@ -320,7 +320,7 @@ static ssize_t boot_store(struct device *dev, return rc; return rc; } } } else { } else { NPU_INFO("%s: unload fw\n", __func__); NPU_DBG("%s: unload fw\n", __func__); unload_fw(npu_dev); unload_fw(npu_dev); } } Loading drivers/media/platform/msm/npu/npu_mgr.c +27 −10 Original line number Original line Diff line number Diff line Loading @@ -150,20 +150,36 @@ static int load_fw_nolock(struct npu_device *npu_dev, bool enable) return ret; return ret; } } static void npu_load_fw_work(struct work_struct *work) { int ret; struct npu_host_ctx *host_ctx; struct npu_device *npu_dev; host_ctx = container_of(work, struct npu_host_ctx, load_fw_work); npu_dev = container_of(host_ctx, struct npu_device, host_ctx); mutex_lock(&host_ctx->lock); ret = load_fw_nolock(npu_dev, false); mutex_unlock(&host_ctx->lock); if (ret) NPU_ERR("load fw failed %d\n", ret); } int load_fw(struct npu_device *npu_dev) int load_fw(struct npu_device *npu_dev) { { struct npu_host_ctx *host_ctx = &npu_dev->host_ctx; struct npu_host_ctx *host_ctx = &npu_dev->host_ctx; int ret = 0; if (host_ctx->auto_pil_disable) { if (host_ctx->auto_pil_disable) { NPU_WARN("auto pil is disabled\n"); NPU_WARN("auto pil is disabled\n"); return ret; return -EINVAL; } } mutex_lock(&host_ctx->lock); ret = load_fw_nolock(npu_dev, false); mutex_unlock(&host_ctx->lock); return ret; if (host_ctx->wq) queue_work(host_ctx->wq, &host_ctx->load_fw_work); return 0; } } int unload_fw(struct npu_device *npu_dev) int unload_fw(struct npu_device *npu_dev) Loading Loading @@ -545,6 +561,7 @@ int npu_host_init(struct npu_device *npu_dev) INIT_WORK(&host_ctx->ipc_irq_work, npu_ipc_irq_work); INIT_WORK(&host_ctx->ipc_irq_work, npu_ipc_irq_work); INIT_WORK(&host_ctx->wdg_err_irq_work, npu_wdg_err_irq_work); INIT_WORK(&host_ctx->wdg_err_irq_work, npu_wdg_err_irq_work); INIT_WORK(&host_ctx->bridge_mbox_work, npu_bridge_mbox_work); INIT_WORK(&host_ctx->bridge_mbox_work, npu_bridge_mbox_work); INIT_WORK(&host_ctx->load_fw_work, npu_load_fw_work); INIT_DELAYED_WORK(&host_ctx->disable_fw_work, INIT_DELAYED_WORK(&host_ctx->disable_fw_work, npu_disable_fw_work); npu_disable_fw_work); } } Loading Loading @@ -821,10 +838,6 @@ static void npu_bridge_mbox_work(struct work_struct *work) host_ctx = container_of(work, struct npu_host_ctx, bridge_mbox_work); host_ctx = container_of(work, struct npu_host_ctx, bridge_mbox_work); npu_dev = container_of(host_ctx, struct npu_device, host_ctx); npu_dev = container_of(host_ctx, struct npu_device, host_ctx); /* queue or modify delayed work to disable fw */ mod_delayed_work(host_ctx->wq, &host_ctx->disable_fw_work, NPU_MBOX_IDLE_TIMEOUT); mutex_lock(&host_ctx->lock); mutex_lock(&host_ctx->lock); if (host_ctx->fw_state == FW_UNLOADED) { if (host_ctx->fw_state == FW_UNLOADED) { NPU_WARN("NPU fw is not loaded\n"); NPU_WARN("NPU fw is not loaded\n"); Loading @@ -832,6 +845,10 @@ static void npu_bridge_mbox_work(struct work_struct *work) return; return; } } /* queue or modify delayed work to disable fw */ mod_delayed_work(host_ctx->wq, &host_ctx->disable_fw_work, NPU_MBOX_IDLE_TIMEOUT); if (!host_ctx->bridge_mbox_pwr_on) { if (!host_ctx->bridge_mbox_pwr_on) { ret = enable_fw_nolock(npu_dev); ret = enable_fw_nolock(npu_dev); if (ret) { if (ret) { Loading drivers/media/platform/msm/npu/npu_mgr.h +1 −0 Original line number Original line Diff line number Diff line Loading @@ -77,6 +77,7 @@ struct npu_host_ctx { struct work_struct ipc_irq_work; struct work_struct ipc_irq_work; struct work_struct wdg_err_irq_work; struct work_struct wdg_err_irq_work; struct work_struct bridge_mbox_work; struct work_struct bridge_mbox_work; struct work_struct load_fw_work; struct delayed_work disable_fw_work; struct delayed_work disable_fw_work; struct workqueue_struct *wq; struct workqueue_struct *wq; struct completion misc_cmd_done; struct completion misc_cmd_done; Loading Loading
drivers/media/platform/msm/npu/npu_dev.c +1 −1 Original line number Original line Diff line number Diff line Loading @@ -320,7 +320,7 @@ static ssize_t boot_store(struct device *dev, return rc; return rc; } } } else { } else { NPU_INFO("%s: unload fw\n", __func__); NPU_DBG("%s: unload fw\n", __func__); unload_fw(npu_dev); unload_fw(npu_dev); } } Loading
drivers/media/platform/msm/npu/npu_mgr.c +27 −10 Original line number Original line Diff line number Diff line Loading @@ -150,20 +150,36 @@ static int load_fw_nolock(struct npu_device *npu_dev, bool enable) return ret; return ret; } } static void npu_load_fw_work(struct work_struct *work) { int ret; struct npu_host_ctx *host_ctx; struct npu_device *npu_dev; host_ctx = container_of(work, struct npu_host_ctx, load_fw_work); npu_dev = container_of(host_ctx, struct npu_device, host_ctx); mutex_lock(&host_ctx->lock); ret = load_fw_nolock(npu_dev, false); mutex_unlock(&host_ctx->lock); if (ret) NPU_ERR("load fw failed %d\n", ret); } int load_fw(struct npu_device *npu_dev) int load_fw(struct npu_device *npu_dev) { { struct npu_host_ctx *host_ctx = &npu_dev->host_ctx; struct npu_host_ctx *host_ctx = &npu_dev->host_ctx; int ret = 0; if (host_ctx->auto_pil_disable) { if (host_ctx->auto_pil_disable) { NPU_WARN("auto pil is disabled\n"); NPU_WARN("auto pil is disabled\n"); return ret; return -EINVAL; } } mutex_lock(&host_ctx->lock); ret = load_fw_nolock(npu_dev, false); mutex_unlock(&host_ctx->lock); return ret; if (host_ctx->wq) queue_work(host_ctx->wq, &host_ctx->load_fw_work); return 0; } } int unload_fw(struct npu_device *npu_dev) int unload_fw(struct npu_device *npu_dev) Loading Loading @@ -545,6 +561,7 @@ int npu_host_init(struct npu_device *npu_dev) INIT_WORK(&host_ctx->ipc_irq_work, npu_ipc_irq_work); INIT_WORK(&host_ctx->ipc_irq_work, npu_ipc_irq_work); INIT_WORK(&host_ctx->wdg_err_irq_work, npu_wdg_err_irq_work); INIT_WORK(&host_ctx->wdg_err_irq_work, npu_wdg_err_irq_work); INIT_WORK(&host_ctx->bridge_mbox_work, npu_bridge_mbox_work); INIT_WORK(&host_ctx->bridge_mbox_work, npu_bridge_mbox_work); INIT_WORK(&host_ctx->load_fw_work, npu_load_fw_work); INIT_DELAYED_WORK(&host_ctx->disable_fw_work, INIT_DELAYED_WORK(&host_ctx->disable_fw_work, npu_disable_fw_work); npu_disable_fw_work); } } Loading Loading @@ -821,10 +838,6 @@ static void npu_bridge_mbox_work(struct work_struct *work) host_ctx = container_of(work, struct npu_host_ctx, bridge_mbox_work); host_ctx = container_of(work, struct npu_host_ctx, bridge_mbox_work); npu_dev = container_of(host_ctx, struct npu_device, host_ctx); npu_dev = container_of(host_ctx, struct npu_device, host_ctx); /* queue or modify delayed work to disable fw */ mod_delayed_work(host_ctx->wq, &host_ctx->disable_fw_work, NPU_MBOX_IDLE_TIMEOUT); mutex_lock(&host_ctx->lock); mutex_lock(&host_ctx->lock); if (host_ctx->fw_state == FW_UNLOADED) { if (host_ctx->fw_state == FW_UNLOADED) { NPU_WARN("NPU fw is not loaded\n"); NPU_WARN("NPU fw is not loaded\n"); Loading @@ -832,6 +845,10 @@ static void npu_bridge_mbox_work(struct work_struct *work) return; return; } } /* queue or modify delayed work to disable fw */ mod_delayed_work(host_ctx->wq, &host_ctx->disable_fw_work, NPU_MBOX_IDLE_TIMEOUT); if (!host_ctx->bridge_mbox_pwr_on) { if (!host_ctx->bridge_mbox_pwr_on) { ret = enable_fw_nolock(npu_dev); ret = enable_fw_nolock(npu_dev); if (ret) { if (ret) { Loading
drivers/media/platform/msm/npu/npu_mgr.h +1 −0 Original line number Original line Diff line number Diff line Loading @@ -77,6 +77,7 @@ struct npu_host_ctx { struct work_struct ipc_irq_work; struct work_struct ipc_irq_work; struct work_struct wdg_err_irq_work; struct work_struct wdg_err_irq_work; struct work_struct bridge_mbox_work; struct work_struct bridge_mbox_work; struct work_struct load_fw_work; struct delayed_work disable_fw_work; struct delayed_work disable_fw_work; struct workqueue_struct *wq; struct workqueue_struct *wq; struct completion misc_cmd_done; struct completion misc_cmd_done; Loading