Loading drivers/media/platform/msm/npu/npu_debugfs.c +7 −4 Original line number Original line Diff line number Diff line Loading @@ -200,7 +200,7 @@ static ssize_t npu_debug_reg_read(struct file *file, return 0; /* done reading */ return 0; /* done reading */ len = min(count, debugfs->buf_len - (size_t) *ppos); len = min(count, debugfs->buf_len - (size_t) *ppos); pr_debug("read %zi %zi", count, debugfs->buf_len - (size_t) *ppos); pr_debug("read %zi %zi\n", count, debugfs->buf_len - (size_t) *ppos); if (copy_to_user(user_buf, debugfs->buf + *ppos, len)) { if (copy_to_user(user_buf, debugfs->buf + *ppos, len)) { pr_err("failed to copy to user\n"); pr_err("failed to copy to user\n"); return -EFAULT; return -EFAULT; Loading Loading @@ -305,7 +305,8 @@ static ssize_t npu_debug_log_read(struct file *file, if (copy_to_user(dst_addr, src_addr, if (copy_to_user(dst_addr, src_addr, remaining_to_end)) { remaining_to_end)) { pr_err("%s failed to copy to user", __func__); pr_err("%s failed to copy to user\n", __func__); mutex_unlock(&debugfs->log_lock); return -EFAULT; return -EFAULT; } } src_addr = debugfs->log_buf; src_addr = debugfs->log_buf; Loading @@ -313,7 +314,8 @@ static ssize_t npu_debug_log_read(struct file *file, if (copy_to_user(dst_addr, src_addr, if (copy_to_user(dst_addr, src_addr, debugfs->log_num_bytes_buffered - debugfs->log_num_bytes_buffered - remaining_to_end)) { remaining_to_end)) { pr_err("%s failed to copy to user", __func__); pr_err("%s failed to copy to user\n", __func__); mutex_unlock(&debugfs->log_lock); return -EFAULT; return -EFAULT; } } debugfs->log_read_index = debugfs->log_read_index = Loading @@ -323,7 +325,8 @@ static ssize_t npu_debug_log_read(struct file *file, if (copy_to_user(user_buf, (debugfs->log_buf + if (copy_to_user(user_buf, (debugfs->log_buf + debugfs->log_read_index), debugfs->log_read_index), debugfs->log_num_bytes_buffered)) { debugfs->log_num_bytes_buffered)) { pr_err("%s failed to copy to user", __func__); pr_err("%s failed to copy to user\n", __func__); mutex_unlock(&debugfs->log_lock); return -EFAULT; return -EFAULT; } } debugfs->log_read_index += debugfs->log_read_index += Loading drivers/media/platform/msm/npu/npu_dev.c +22 −15 Original line number Original line Diff line number Diff line Loading @@ -249,7 +249,7 @@ static ssize_t npu_show_capabilities(struct device *dev, struct npu_device *npu_dev = dev_get_drvdata(dev); struct npu_device *npu_dev = dev_get_drvdata(dev); if (!npu_enable_core_power(npu_dev)) { if (!npu_enable_core_power(npu_dev)) { if (snprintf(buf, PAGE_SIZE, "hw_version :0x%X", if (scnprintf(buf, PAGE_SIZE, "hw_version :0x%X", REGR(npu_dev, NPU_HW_VERSION)) < 0) REGR(npu_dev, NPU_HW_VERSION)) < 0) ret = -EINVAL; ret = -EINVAL; npu_disable_core_power(npu_dev); npu_disable_core_power(npu_dev); Loading @@ -270,7 +270,7 @@ static ssize_t npu_show_pwr_state(struct device *dev, struct npu_device *npu_dev = dev_get_drvdata(dev); struct npu_device *npu_dev = dev_get_drvdata(dev); struct npu_pwrctrl *pwr = &npu_dev->pwrctrl; struct npu_pwrctrl *pwr = &npu_dev->pwrctrl; return snprintf(buf, PAGE_SIZE, "%s\n", return scnprintf(buf, PAGE_SIZE, "%s\n", (pwr->pwr_vote_num > 0) ? "on" : "off"); (pwr->pwr_vote_num > 0) ? "on" : "off"); } } Loading Loading @@ -1744,7 +1744,7 @@ static int npu_of_parse_pwrlevels(struct npu_device *npu_dev, } } of_property_read_u32(node, "initial-pwrlevel", &init_level_index); of_property_read_u32(node, "initial-pwrlevel", &init_level_index); pr_debug("initial-pwrlevel %d", init_level_index); pr_debug("initial-pwrlevel %d\n", init_level_index); if (init_level_index >= pwr->num_pwrlevels) if (init_level_index >= pwr->num_pwrlevels) init_level_index = pwr->num_pwrlevels - 1; init_level_index = pwr->num_pwrlevels - 1; Loading Loading @@ -1813,11 +1813,10 @@ static int npu_thermalctrl_init(struct npu_device *npu_dev) { { struct npu_pwrctrl *pwr = &npu_dev->pwrctrl; struct npu_pwrctrl *pwr = &npu_dev->pwrctrl; struct npu_thermalctrl *thermalctrl = &npu_dev->thermalctrl; struct npu_thermalctrl *thermalctrl = &npu_dev->thermalctrl; int ret = 0; thermalctrl->max_state = pwr->num_pwrlevels - 1; thermalctrl->max_state = pwr->num_pwrlevels - 1; thermalctrl->current_state = 0; thermalctrl->current_state = 0; return ret; return 0; } } static int npu_irq_init(struct npu_device *npu_dev) static int npu_irq_init(struct npu_device *npu_dev) Loading Loading @@ -1877,6 +1876,14 @@ static int npu_mbox_init(struct npu_device *npu_dev) return 0; return 0; } } static void npu_mbox_deinit(struct npu_device *npu_dev) { if (npu_dev->mbox_aop.chan) { mbox_free_channel(npu_dev->mbox_aop.chan); npu_dev->mbox_aop.chan = NULL; } } /* ------------------------------------------------------------------------- /* ------------------------------------------------------------------------- * Probe/Remove * Probe/Remove * ------------------------------------------------------------------------- * ------------------------------------------------------------------------- Loading Loading @@ -1999,7 +2006,7 @@ static int npu_probe(struct platform_device *pdev) &npu_cooling_ops); &npu_cooling_ops); if (IS_ERR(tcdev)) { if (IS_ERR(tcdev)) { dev_err(&pdev->dev, dev_err(&pdev->dev, "npu: failed to register npu as cooling device"); "npu: failed to register npu as cooling device\n"); rc = PTR_ERR(tcdev); rc = PTR_ERR(tcdev); goto error_driver_init; goto error_driver_init; } } Loading Loading @@ -2044,11 +2051,12 @@ static int npu_probe(struct platform_device *pdev) return rc; return rc; error_driver_init: error_driver_init: npu_cdsprm_cxlimit_deinit(npu_dev); sysfs_remove_group(&npu_dev->device->kobj, &npu_fs_attr_group); arm_iommu_detach_device(&(npu_dev->pdev->dev)); arm_iommu_detach_device(&(npu_dev->pdev->dev)); if (!npu_dev->smmu_ctx.mmu_mapping) if (!npu_dev->smmu_ctx.mmu_mapping) arm_iommu_release_mapping(npu_dev->smmu_ctx.mmu_mapping); arm_iommu_release_mapping(npu_dev->smmu_ctx.mmu_mapping); npu_cdsprm_cxlimit_deinit(npu_dev); if (npu_dev->tcdev) thermal_cooling_device_unregister(npu_dev->tcdev); sysfs_remove_group(&npu_dev->device->kobj, &npu_fs_attr_group); sysfs_remove_group(&npu_dev->device->kobj, &npu_fs_attr_group); error_res_init: error_res_init: cdev_del(&npu_dev->cdev); cdev_del(&npu_dev->cdev); Loading @@ -2058,8 +2066,7 @@ static int npu_probe(struct platform_device *pdev) class_destroy(npu_dev->class); class_destroy(npu_dev->class); error_class_create: error_class_create: unregister_chrdev_region(npu_dev->dev_num, 1); unregister_chrdev_region(npu_dev->dev_num, 1); if (npu_dev->mbox_aop.chan) npu_mbox_deinit(npu_dev); mbox_free_channel(npu_dev->mbox_aop.chan); error_get_dev_num: error_get_dev_num: return rc; return rc; } } Loading @@ -2069,20 +2076,20 @@ static int npu_remove(struct platform_device *pdev) struct npu_device *npu_dev; struct npu_device *npu_dev; npu_dev = platform_get_drvdata(pdev); npu_dev = platform_get_drvdata(pdev); thermal_cooling_device_unregister(npu_dev->tcdev); npu_cdsprm_cxlimit_deinit(npu_dev); npu_debugfs_deinit(npu_dev); npu_host_deinit(npu_dev); npu_host_deinit(npu_dev); arm_iommu_detach_device(&(npu_dev->pdev->dev)); arm_iommu_detach_device(&(npu_dev->pdev->dev)); arm_iommu_release_mapping(npu_dev->smmu_ctx.mmu_mapping); arm_iommu_release_mapping(npu_dev->smmu_ctx.mmu_mapping); npu_debugfs_deinit(npu_dev); npu_cdsprm_cxlimit_deinit(npu_dev); if (npu_dev->tcdev) thermal_cooling_device_unregister(npu_dev->tcdev); sysfs_remove_group(&npu_dev->device->kobj, &npu_fs_attr_group); sysfs_remove_group(&npu_dev->device->kobj, &npu_fs_attr_group); cdev_del(&npu_dev->cdev); cdev_del(&npu_dev->cdev); device_destroy(npu_dev->class, npu_dev->dev_num); device_destroy(npu_dev->class, npu_dev->dev_num); class_destroy(npu_dev->class); class_destroy(npu_dev->class); unregister_chrdev_region(npu_dev->dev_num, 1); unregister_chrdev_region(npu_dev->dev_num, 1); platform_set_drvdata(pdev, NULL); platform_set_drvdata(pdev, NULL); if (npu_dev->mbox_aop.chan) npu_mbox_deinit(npu_dev); mbox_free_channel(npu_dev->mbox_aop.chan); g_npu_dev = NULL; g_npu_dev = NULL; Loading drivers/media/platform/msm/npu/npu_host_ipc.c +3 −3 Original line number Original line Diff line number Diff line Loading @@ -175,9 +175,9 @@ static int npu_host_ipc_send_cmd_hfi(struct npu_device *npu_dev, } } if (status == 0) if (status == 0) pr_debug("Cmd Msg put on Command Queue - SUCCESSS"); pr_debug("Cmd Msg put on Command Queue - SUCCESSS\n"); else else pr_err("Cmd Msg put on Command Queue - FAILURE"); pr_err("Cmd Msg put on Command Queue - FAILURE\n"); return status; return status; } } Loading Loading @@ -238,7 +238,7 @@ static int ipc_queue_read(struct npu_device *npu_dev, MEMR(npu_dev, (void *)((size_t)read_ptr), packet, 4); MEMR(npu_dev, (void *)((size_t)read_ptr), packet, 4); packet_size = *((uint32_t *)packet); packet_size = *((uint32_t *)packet); pr_debug("target_que: %d, packet_size: %d ", pr_debug("target_que: %d, packet_size: %d\n", target_que, target_que, packet_size); packet_size); Loading drivers/media/platform/msm/npu/npu_hw_access.c +2 −4 Original line number Original line Diff line number Diff line Loading @@ -148,15 +148,13 @@ void npu_interrupt_ack(struct npu_device *npu_dev, uint32_t intr_num) int32_t npu_interrupt_raise_m0(struct npu_device *npu_dev) int32_t npu_interrupt_raise_m0(struct npu_device *npu_dev) { { int ret = 0; /* Bit 4 is setting IRQ_SOURCE_SELECT to local /* Bit 4 is setting IRQ_SOURCE_SELECT to local * and we're triggering a pulse to NPU_MASTER0_IPC_IN_IRQ0 * and we're triggering a pulse to NPU_MASTER0_IPC_IN_IRQ0 */ */ npu_reg_write(npu_dev, NPU_MASTERn_IPC_IRQ_IN_CTRL(0), 0x1 npu_reg_write(npu_dev, NPU_MASTERn_IPC_IRQ_IN_CTRL(0), 0x1 << NPU_MASTER0_IPC_IRQ_IN_CTRL__IRQ_SOURCE_SELECT___S | 0x1); << NPU_MASTER0_IPC_IRQ_IN_CTRL__IRQ_SOURCE_SELECT___S | 0x1); return ret; return 0; } } int32_t npu_interrupt_raise_dsp(struct npu_device *npu_dev) int32_t npu_interrupt_raise_dsp(struct npu_device *npu_dev) Loading Loading @@ -291,7 +289,7 @@ int npu_mem_map(struct npu_client *client, int buf_hdl, uint32_t size, dma_sync_sg_for_device(&(npu_dev->pdev->dev), ion_buf->table->sgl, dma_sync_sg_for_device(&(npu_dev->pdev->dev), ion_buf->table->sgl, ion_buf->table->nents, DMA_BIDIRECTIONAL); ion_buf->table->nents, DMA_BIDIRECTIONAL); ion_buf->iova = ion_buf->table->sgl->dma_address; ion_buf->iova = ion_buf->table->sgl->dma_address; ion_buf->size = ion_buf->table->sgl->dma_length; ion_buf->size = ion_buf->dma_buf->size; *addr = ion_buf->iova; *addr = ion_buf->iova; pr_debug("mapped mem addr:0x%llx size:0x%x\n", ion_buf->iova, pr_debug("mapped mem addr:0x%llx size:0x%x\n", ion_buf->iova, ion_buf->size); ion_buf->size); Loading drivers/media/platform/msm/npu/npu_mgr.c +8 −9 Original line number Original line Diff line number Diff line Loading @@ -75,6 +75,7 @@ int fw_init(struct npu_device *npu_dev) uint32_t reg_val; uint32_t reg_val; struct npu_host_ctx *host_ctx = &npu_dev->host_ctx; struct npu_host_ctx *host_ctx = &npu_dev->host_ctx; int ret = 0; int ret = 0; mutex_lock(&host_ctx->lock); mutex_lock(&host_ctx->lock); if (host_ctx->fw_state == FW_ENABLED) { if (host_ctx->fw_state == FW_ENABLED) { host_ctx->fw_ref_cnt++; host_ctx->fw_ref_cnt++; Loading Loading @@ -270,8 +271,6 @@ void fw_deinit(struct npu_device *npu_dev, bool ssr, bool fw_alive) mutex_unlock(&host_ctx->lock); mutex_unlock(&host_ctx->lock); pr_debug("firmware deinit complete\n"); pr_debug("firmware deinit complete\n"); npu_notify_aop(npu_dev, false); npu_notify_aop(npu_dev, false); return; } } int npu_host_init(struct npu_device *npu_dev) int npu_host_init(struct npu_device *npu_dev) Loading Loading @@ -315,7 +314,7 @@ irqreturn_t npu_intr_hdler(int irq, void *ptr) INTERRUPT_ACK(npu_dev, irq); INTERRUPT_ACK(npu_dev, irq); /* Check that the event thread currently is running */ /* Check that the event thread currently is running */ if (host_ctx->wq != 0) if (host_ctx->wq) queue_work(host_ctx->wq, &host_ctx->irq_work); queue_work(host_ctx->wq, &host_ctx->irq_work); return IRQ_HANDLED; return IRQ_HANDLED; Loading Loading @@ -471,7 +470,7 @@ static int npu_notify_aop(struct npu_device *npu_dev, bool on) return 0; return 0; } } buf_size = snprintf(buf, MAX_LEN, "{class: bcm, res: npu_on, val: %d}", buf_size = scnprintf(buf, MAX_LEN, "{class: bcm, res: npu_on, val: %d}", on ? 1 : 0); on ? 1 : 0); if (buf_size < 0) { if (buf_size < 0) { pr_err("prepare qmp notify buf failed\n"); pr_err("prepare qmp notify buf failed\n"); Loading Loading @@ -656,7 +655,7 @@ static void app_msg_proc(struct npu_host_ctx *host_ctx, uint32_t *msg) pr_debug("NPU_IPC_MSG_EXECUTE_DONE status: %d\n", pr_debug("NPU_IPC_MSG_EXECUTE_DONE status: %d\n", exe_rsp_pkt->header.status); exe_rsp_pkt->header.status); pr_debug("trans_id : %d", exe_rsp_pkt->header.trans_id); pr_debug("trans_id : %d\n", exe_rsp_pkt->header.trans_id); pr_debug("e2e_IPC_time: %d (in tick count)\n", pr_debug("e2e_IPC_time: %d (in tick count)\n", exe_rsp_pkt->stats.e2e_ipc_tick_count); exe_rsp_pkt->stats.e2e_ipc_tick_count); pr_debug("aco_load_time: %d (in tick count)\n", pr_debug("aco_load_time: %d (in tick count)\n", Loading Loading @@ -709,7 +708,7 @@ static void app_msg_proc(struct npu_host_ctx *host_ctx, uint32_t *msg) pr_debug("NPU_IPC_MSG_EXECUTE_V2_DONE status: %d\n", pr_debug("NPU_IPC_MSG_EXECUTE_V2_DONE status: %d\n", exe_rsp_pkt->header.status); exe_rsp_pkt->header.status); pr_debug("trans_id : %d", exe_rsp_pkt->header.trans_id); pr_debug("trans_id : %d\n", exe_rsp_pkt->header.trans_id); network = get_network_by_hdl(host_ctx, NULL, network = get_network_by_hdl(host_ctx, NULL, exe_rsp_pkt->network_hdl); exe_rsp_pkt->network_hdl); Loading @@ -727,7 +726,7 @@ static void app_msg_proc(struct npu_host_ctx *host_ctx, uint32_t *msg) break; break; } } pr_debug("network id : %d", network->id); pr_debug("network id : %d\n", network->id); stats_size = exe_rsp_pkt->header.size - sizeof(*exe_rsp_pkt); stats_size = exe_rsp_pkt->header.size - sizeof(*exe_rsp_pkt); pr_debug("stats_size %d:%d\n", exe_rsp_pkt->header.size, pr_debug("stats_size %d:%d\n", exe_rsp_pkt->header.size, stats_size); stats_size); Loading Loading @@ -1384,7 +1383,7 @@ int32_t npu_host_unload_network(struct npu_client *client, pr_err("fw is in error state during unload network\n"); pr_err("fw is in error state during unload network\n"); } else { } else { ret = network->cmd_ret_status; ret = network->cmd_ret_status; pr_debug("unload network status %d", ret); pr_debug("unload network status %d\n", ret); } } free_network: free_network: Loading Loading @@ -1516,7 +1515,7 @@ int32_t npu_host_exec_network(struct npu_client *client, pr_err("fw is in error state during execute network\n"); pr_err("fw is in error state during execute network\n"); } else { } else { ret = network->cmd_ret_status; ret = network->cmd_ret_status; pr_debug("execution status %d", ret); pr_debug("execution status %d\n", ret); } } exec_done: exec_done: Loading Loading
drivers/media/platform/msm/npu/npu_debugfs.c +7 −4 Original line number Original line Diff line number Diff line Loading @@ -200,7 +200,7 @@ static ssize_t npu_debug_reg_read(struct file *file, return 0; /* done reading */ return 0; /* done reading */ len = min(count, debugfs->buf_len - (size_t) *ppos); len = min(count, debugfs->buf_len - (size_t) *ppos); pr_debug("read %zi %zi", count, debugfs->buf_len - (size_t) *ppos); pr_debug("read %zi %zi\n", count, debugfs->buf_len - (size_t) *ppos); if (copy_to_user(user_buf, debugfs->buf + *ppos, len)) { if (copy_to_user(user_buf, debugfs->buf + *ppos, len)) { pr_err("failed to copy to user\n"); pr_err("failed to copy to user\n"); return -EFAULT; return -EFAULT; Loading Loading @@ -305,7 +305,8 @@ static ssize_t npu_debug_log_read(struct file *file, if (copy_to_user(dst_addr, src_addr, if (copy_to_user(dst_addr, src_addr, remaining_to_end)) { remaining_to_end)) { pr_err("%s failed to copy to user", __func__); pr_err("%s failed to copy to user\n", __func__); mutex_unlock(&debugfs->log_lock); return -EFAULT; return -EFAULT; } } src_addr = debugfs->log_buf; src_addr = debugfs->log_buf; Loading @@ -313,7 +314,8 @@ static ssize_t npu_debug_log_read(struct file *file, if (copy_to_user(dst_addr, src_addr, if (copy_to_user(dst_addr, src_addr, debugfs->log_num_bytes_buffered - debugfs->log_num_bytes_buffered - remaining_to_end)) { remaining_to_end)) { pr_err("%s failed to copy to user", __func__); pr_err("%s failed to copy to user\n", __func__); mutex_unlock(&debugfs->log_lock); return -EFAULT; return -EFAULT; } } debugfs->log_read_index = debugfs->log_read_index = Loading @@ -323,7 +325,8 @@ static ssize_t npu_debug_log_read(struct file *file, if (copy_to_user(user_buf, (debugfs->log_buf + if (copy_to_user(user_buf, (debugfs->log_buf + debugfs->log_read_index), debugfs->log_read_index), debugfs->log_num_bytes_buffered)) { debugfs->log_num_bytes_buffered)) { pr_err("%s failed to copy to user", __func__); pr_err("%s failed to copy to user\n", __func__); mutex_unlock(&debugfs->log_lock); return -EFAULT; return -EFAULT; } } debugfs->log_read_index += debugfs->log_read_index += Loading
drivers/media/platform/msm/npu/npu_dev.c +22 −15 Original line number Original line Diff line number Diff line Loading @@ -249,7 +249,7 @@ static ssize_t npu_show_capabilities(struct device *dev, struct npu_device *npu_dev = dev_get_drvdata(dev); struct npu_device *npu_dev = dev_get_drvdata(dev); if (!npu_enable_core_power(npu_dev)) { if (!npu_enable_core_power(npu_dev)) { if (snprintf(buf, PAGE_SIZE, "hw_version :0x%X", if (scnprintf(buf, PAGE_SIZE, "hw_version :0x%X", REGR(npu_dev, NPU_HW_VERSION)) < 0) REGR(npu_dev, NPU_HW_VERSION)) < 0) ret = -EINVAL; ret = -EINVAL; npu_disable_core_power(npu_dev); npu_disable_core_power(npu_dev); Loading @@ -270,7 +270,7 @@ static ssize_t npu_show_pwr_state(struct device *dev, struct npu_device *npu_dev = dev_get_drvdata(dev); struct npu_device *npu_dev = dev_get_drvdata(dev); struct npu_pwrctrl *pwr = &npu_dev->pwrctrl; struct npu_pwrctrl *pwr = &npu_dev->pwrctrl; return snprintf(buf, PAGE_SIZE, "%s\n", return scnprintf(buf, PAGE_SIZE, "%s\n", (pwr->pwr_vote_num > 0) ? "on" : "off"); (pwr->pwr_vote_num > 0) ? "on" : "off"); } } Loading Loading @@ -1744,7 +1744,7 @@ static int npu_of_parse_pwrlevels(struct npu_device *npu_dev, } } of_property_read_u32(node, "initial-pwrlevel", &init_level_index); of_property_read_u32(node, "initial-pwrlevel", &init_level_index); pr_debug("initial-pwrlevel %d", init_level_index); pr_debug("initial-pwrlevel %d\n", init_level_index); if (init_level_index >= pwr->num_pwrlevels) if (init_level_index >= pwr->num_pwrlevels) init_level_index = pwr->num_pwrlevels - 1; init_level_index = pwr->num_pwrlevels - 1; Loading Loading @@ -1813,11 +1813,10 @@ static int npu_thermalctrl_init(struct npu_device *npu_dev) { { struct npu_pwrctrl *pwr = &npu_dev->pwrctrl; struct npu_pwrctrl *pwr = &npu_dev->pwrctrl; struct npu_thermalctrl *thermalctrl = &npu_dev->thermalctrl; struct npu_thermalctrl *thermalctrl = &npu_dev->thermalctrl; int ret = 0; thermalctrl->max_state = pwr->num_pwrlevels - 1; thermalctrl->max_state = pwr->num_pwrlevels - 1; thermalctrl->current_state = 0; thermalctrl->current_state = 0; return ret; return 0; } } static int npu_irq_init(struct npu_device *npu_dev) static int npu_irq_init(struct npu_device *npu_dev) Loading Loading @@ -1877,6 +1876,14 @@ static int npu_mbox_init(struct npu_device *npu_dev) return 0; return 0; } } static void npu_mbox_deinit(struct npu_device *npu_dev) { if (npu_dev->mbox_aop.chan) { mbox_free_channel(npu_dev->mbox_aop.chan); npu_dev->mbox_aop.chan = NULL; } } /* ------------------------------------------------------------------------- /* ------------------------------------------------------------------------- * Probe/Remove * Probe/Remove * ------------------------------------------------------------------------- * ------------------------------------------------------------------------- Loading Loading @@ -1999,7 +2006,7 @@ static int npu_probe(struct platform_device *pdev) &npu_cooling_ops); &npu_cooling_ops); if (IS_ERR(tcdev)) { if (IS_ERR(tcdev)) { dev_err(&pdev->dev, dev_err(&pdev->dev, "npu: failed to register npu as cooling device"); "npu: failed to register npu as cooling device\n"); rc = PTR_ERR(tcdev); rc = PTR_ERR(tcdev); goto error_driver_init; goto error_driver_init; } } Loading Loading @@ -2044,11 +2051,12 @@ static int npu_probe(struct platform_device *pdev) return rc; return rc; error_driver_init: error_driver_init: npu_cdsprm_cxlimit_deinit(npu_dev); sysfs_remove_group(&npu_dev->device->kobj, &npu_fs_attr_group); arm_iommu_detach_device(&(npu_dev->pdev->dev)); arm_iommu_detach_device(&(npu_dev->pdev->dev)); if (!npu_dev->smmu_ctx.mmu_mapping) if (!npu_dev->smmu_ctx.mmu_mapping) arm_iommu_release_mapping(npu_dev->smmu_ctx.mmu_mapping); arm_iommu_release_mapping(npu_dev->smmu_ctx.mmu_mapping); npu_cdsprm_cxlimit_deinit(npu_dev); if (npu_dev->tcdev) thermal_cooling_device_unregister(npu_dev->tcdev); sysfs_remove_group(&npu_dev->device->kobj, &npu_fs_attr_group); sysfs_remove_group(&npu_dev->device->kobj, &npu_fs_attr_group); error_res_init: error_res_init: cdev_del(&npu_dev->cdev); cdev_del(&npu_dev->cdev); Loading @@ -2058,8 +2066,7 @@ static int npu_probe(struct platform_device *pdev) class_destroy(npu_dev->class); class_destroy(npu_dev->class); error_class_create: error_class_create: unregister_chrdev_region(npu_dev->dev_num, 1); unregister_chrdev_region(npu_dev->dev_num, 1); if (npu_dev->mbox_aop.chan) npu_mbox_deinit(npu_dev); mbox_free_channel(npu_dev->mbox_aop.chan); error_get_dev_num: error_get_dev_num: return rc; return rc; } } Loading @@ -2069,20 +2076,20 @@ static int npu_remove(struct platform_device *pdev) struct npu_device *npu_dev; struct npu_device *npu_dev; npu_dev = platform_get_drvdata(pdev); npu_dev = platform_get_drvdata(pdev); thermal_cooling_device_unregister(npu_dev->tcdev); npu_cdsprm_cxlimit_deinit(npu_dev); npu_debugfs_deinit(npu_dev); npu_host_deinit(npu_dev); npu_host_deinit(npu_dev); arm_iommu_detach_device(&(npu_dev->pdev->dev)); arm_iommu_detach_device(&(npu_dev->pdev->dev)); arm_iommu_release_mapping(npu_dev->smmu_ctx.mmu_mapping); arm_iommu_release_mapping(npu_dev->smmu_ctx.mmu_mapping); npu_debugfs_deinit(npu_dev); npu_cdsprm_cxlimit_deinit(npu_dev); if (npu_dev->tcdev) thermal_cooling_device_unregister(npu_dev->tcdev); sysfs_remove_group(&npu_dev->device->kobj, &npu_fs_attr_group); sysfs_remove_group(&npu_dev->device->kobj, &npu_fs_attr_group); cdev_del(&npu_dev->cdev); cdev_del(&npu_dev->cdev); device_destroy(npu_dev->class, npu_dev->dev_num); device_destroy(npu_dev->class, npu_dev->dev_num); class_destroy(npu_dev->class); class_destroy(npu_dev->class); unregister_chrdev_region(npu_dev->dev_num, 1); unregister_chrdev_region(npu_dev->dev_num, 1); platform_set_drvdata(pdev, NULL); platform_set_drvdata(pdev, NULL); if (npu_dev->mbox_aop.chan) npu_mbox_deinit(npu_dev); mbox_free_channel(npu_dev->mbox_aop.chan); g_npu_dev = NULL; g_npu_dev = NULL; Loading
drivers/media/platform/msm/npu/npu_host_ipc.c +3 −3 Original line number Original line Diff line number Diff line Loading @@ -175,9 +175,9 @@ static int npu_host_ipc_send_cmd_hfi(struct npu_device *npu_dev, } } if (status == 0) if (status == 0) pr_debug("Cmd Msg put on Command Queue - SUCCESSS"); pr_debug("Cmd Msg put on Command Queue - SUCCESSS\n"); else else pr_err("Cmd Msg put on Command Queue - FAILURE"); pr_err("Cmd Msg put on Command Queue - FAILURE\n"); return status; return status; } } Loading Loading @@ -238,7 +238,7 @@ static int ipc_queue_read(struct npu_device *npu_dev, MEMR(npu_dev, (void *)((size_t)read_ptr), packet, 4); MEMR(npu_dev, (void *)((size_t)read_ptr), packet, 4); packet_size = *((uint32_t *)packet); packet_size = *((uint32_t *)packet); pr_debug("target_que: %d, packet_size: %d ", pr_debug("target_que: %d, packet_size: %d\n", target_que, target_que, packet_size); packet_size); Loading
drivers/media/platform/msm/npu/npu_hw_access.c +2 −4 Original line number Original line Diff line number Diff line Loading @@ -148,15 +148,13 @@ void npu_interrupt_ack(struct npu_device *npu_dev, uint32_t intr_num) int32_t npu_interrupt_raise_m0(struct npu_device *npu_dev) int32_t npu_interrupt_raise_m0(struct npu_device *npu_dev) { { int ret = 0; /* Bit 4 is setting IRQ_SOURCE_SELECT to local /* Bit 4 is setting IRQ_SOURCE_SELECT to local * and we're triggering a pulse to NPU_MASTER0_IPC_IN_IRQ0 * and we're triggering a pulse to NPU_MASTER0_IPC_IN_IRQ0 */ */ npu_reg_write(npu_dev, NPU_MASTERn_IPC_IRQ_IN_CTRL(0), 0x1 npu_reg_write(npu_dev, NPU_MASTERn_IPC_IRQ_IN_CTRL(0), 0x1 << NPU_MASTER0_IPC_IRQ_IN_CTRL__IRQ_SOURCE_SELECT___S | 0x1); << NPU_MASTER0_IPC_IRQ_IN_CTRL__IRQ_SOURCE_SELECT___S | 0x1); return ret; return 0; } } int32_t npu_interrupt_raise_dsp(struct npu_device *npu_dev) int32_t npu_interrupt_raise_dsp(struct npu_device *npu_dev) Loading Loading @@ -291,7 +289,7 @@ int npu_mem_map(struct npu_client *client, int buf_hdl, uint32_t size, dma_sync_sg_for_device(&(npu_dev->pdev->dev), ion_buf->table->sgl, dma_sync_sg_for_device(&(npu_dev->pdev->dev), ion_buf->table->sgl, ion_buf->table->nents, DMA_BIDIRECTIONAL); ion_buf->table->nents, DMA_BIDIRECTIONAL); ion_buf->iova = ion_buf->table->sgl->dma_address; ion_buf->iova = ion_buf->table->sgl->dma_address; ion_buf->size = ion_buf->table->sgl->dma_length; ion_buf->size = ion_buf->dma_buf->size; *addr = ion_buf->iova; *addr = ion_buf->iova; pr_debug("mapped mem addr:0x%llx size:0x%x\n", ion_buf->iova, pr_debug("mapped mem addr:0x%llx size:0x%x\n", ion_buf->iova, ion_buf->size); ion_buf->size); Loading
drivers/media/platform/msm/npu/npu_mgr.c +8 −9 Original line number Original line Diff line number Diff line Loading @@ -75,6 +75,7 @@ int fw_init(struct npu_device *npu_dev) uint32_t reg_val; uint32_t reg_val; struct npu_host_ctx *host_ctx = &npu_dev->host_ctx; struct npu_host_ctx *host_ctx = &npu_dev->host_ctx; int ret = 0; int ret = 0; mutex_lock(&host_ctx->lock); mutex_lock(&host_ctx->lock); if (host_ctx->fw_state == FW_ENABLED) { if (host_ctx->fw_state == FW_ENABLED) { host_ctx->fw_ref_cnt++; host_ctx->fw_ref_cnt++; Loading Loading @@ -270,8 +271,6 @@ void fw_deinit(struct npu_device *npu_dev, bool ssr, bool fw_alive) mutex_unlock(&host_ctx->lock); mutex_unlock(&host_ctx->lock); pr_debug("firmware deinit complete\n"); pr_debug("firmware deinit complete\n"); npu_notify_aop(npu_dev, false); npu_notify_aop(npu_dev, false); return; } } int npu_host_init(struct npu_device *npu_dev) int npu_host_init(struct npu_device *npu_dev) Loading Loading @@ -315,7 +314,7 @@ irqreturn_t npu_intr_hdler(int irq, void *ptr) INTERRUPT_ACK(npu_dev, irq); INTERRUPT_ACK(npu_dev, irq); /* Check that the event thread currently is running */ /* Check that the event thread currently is running */ if (host_ctx->wq != 0) if (host_ctx->wq) queue_work(host_ctx->wq, &host_ctx->irq_work); queue_work(host_ctx->wq, &host_ctx->irq_work); return IRQ_HANDLED; return IRQ_HANDLED; Loading Loading @@ -471,7 +470,7 @@ static int npu_notify_aop(struct npu_device *npu_dev, bool on) return 0; return 0; } } buf_size = snprintf(buf, MAX_LEN, "{class: bcm, res: npu_on, val: %d}", buf_size = scnprintf(buf, MAX_LEN, "{class: bcm, res: npu_on, val: %d}", on ? 1 : 0); on ? 1 : 0); if (buf_size < 0) { if (buf_size < 0) { pr_err("prepare qmp notify buf failed\n"); pr_err("prepare qmp notify buf failed\n"); Loading Loading @@ -656,7 +655,7 @@ static void app_msg_proc(struct npu_host_ctx *host_ctx, uint32_t *msg) pr_debug("NPU_IPC_MSG_EXECUTE_DONE status: %d\n", pr_debug("NPU_IPC_MSG_EXECUTE_DONE status: %d\n", exe_rsp_pkt->header.status); exe_rsp_pkt->header.status); pr_debug("trans_id : %d", exe_rsp_pkt->header.trans_id); pr_debug("trans_id : %d\n", exe_rsp_pkt->header.trans_id); pr_debug("e2e_IPC_time: %d (in tick count)\n", pr_debug("e2e_IPC_time: %d (in tick count)\n", exe_rsp_pkt->stats.e2e_ipc_tick_count); exe_rsp_pkt->stats.e2e_ipc_tick_count); pr_debug("aco_load_time: %d (in tick count)\n", pr_debug("aco_load_time: %d (in tick count)\n", Loading Loading @@ -709,7 +708,7 @@ static void app_msg_proc(struct npu_host_ctx *host_ctx, uint32_t *msg) pr_debug("NPU_IPC_MSG_EXECUTE_V2_DONE status: %d\n", pr_debug("NPU_IPC_MSG_EXECUTE_V2_DONE status: %d\n", exe_rsp_pkt->header.status); exe_rsp_pkt->header.status); pr_debug("trans_id : %d", exe_rsp_pkt->header.trans_id); pr_debug("trans_id : %d\n", exe_rsp_pkt->header.trans_id); network = get_network_by_hdl(host_ctx, NULL, network = get_network_by_hdl(host_ctx, NULL, exe_rsp_pkt->network_hdl); exe_rsp_pkt->network_hdl); Loading @@ -727,7 +726,7 @@ static void app_msg_proc(struct npu_host_ctx *host_ctx, uint32_t *msg) break; break; } } pr_debug("network id : %d", network->id); pr_debug("network id : %d\n", network->id); stats_size = exe_rsp_pkt->header.size - sizeof(*exe_rsp_pkt); stats_size = exe_rsp_pkt->header.size - sizeof(*exe_rsp_pkt); pr_debug("stats_size %d:%d\n", exe_rsp_pkt->header.size, pr_debug("stats_size %d:%d\n", exe_rsp_pkt->header.size, stats_size); stats_size); Loading Loading @@ -1384,7 +1383,7 @@ int32_t npu_host_unload_network(struct npu_client *client, pr_err("fw is in error state during unload network\n"); pr_err("fw is in error state during unload network\n"); } else { } else { ret = network->cmd_ret_status; ret = network->cmd_ret_status; pr_debug("unload network status %d", ret); pr_debug("unload network status %d\n", ret); } } free_network: free_network: Loading Loading @@ -1516,7 +1515,7 @@ int32_t npu_host_exec_network(struct npu_client *client, pr_err("fw is in error state during execute network\n"); pr_err("fw is in error state during execute network\n"); } else { } else { ret = network->cmd_ret_status; ret = network->cmd_ret_status; pr_debug("execution status %d", ret); pr_debug("execution status %d\n", ret); } } exec_done: exec_done: Loading