Loading drivers/slimbus/slim-msm-ctrl.c +10 −1 Original line number Diff line number Diff line /* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved. /* Copyright (c) 2011-2015, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -1390,6 +1390,10 @@ err_request_irq_failed: kthread_stop(dev->rx_msgq_thread); err_thread_create_failed: msm_slim_sps_exit(dev, true); msm_slim_deinit_ep(dev, &dev->rx_msgq, &dev->use_rx_msgqs); msm_slim_deinit_ep(dev, &dev->tx_msgq, &dev->use_tx_msgqs); err_sps_init_failed: if (dev->hclk) { clk_disable_unprepare(dev->hclk); Loading Loading @@ -1435,6 +1439,11 @@ static int msm_slim_remove(struct platform_device *pdev) if (dev->hclk) clk_put(dev->hclk); msm_slim_sps_exit(dev, true); msm_slim_deinit_ep(dev, &dev->rx_msgq, &dev->use_rx_msgqs); msm_slim_deinit_ep(dev, &dev->tx_msgq, &dev->use_tx_msgqs); kthread_stop(dev->rx_msgq_thread); iounmap(dev->bam.base); iounmap(dev->base); Loading drivers/slimbus/slim-msm-ngd.c +6 −12 Original line number Diff line number Diff line Loading @@ -84,6 +84,7 @@ enum ngd_status { static void ngd_slim_rx(struct msm_slim_ctrl *dev, u8 *buf); static int ngd_slim_runtime_resume(struct device *device); static int ngd_slim_power_up(struct msm_slim_ctrl *dev, bool mdm_restart); static void ngd_adsp_down(struct msm_slim_ctrl *dev); static irqreturn_t ngd_slim_interrupt(int irq, void *d) { Loading Loading @@ -184,15 +185,13 @@ static int dsp_ssr_notify_cb(struct notifier_block *n, unsigned long code, /* make sure autosuspend is not called until ADSP comes up*/ pm_runtime_get_noresume(dev->dev); dev->state = MSM_CTRL_DOWN; /* Reset ctrl_up completion */ init_completion(&dev->ctrl_up); /* disconnect BAM pipes */ if (dev->use_rx_msgqs == MSM_MSGQ_ENABLED) dev->use_rx_msgqs = MSM_MSGQ_DOWN; if (dev->use_tx_msgqs == MSM_MSGQ_ENABLED) dev->use_tx_msgqs = MSM_MSGQ_DOWN; msm_slim_sps_exit(dev, false); schedule_work(&dev->qmi.ssr_down); ngd_adsp_down(dev); mutex_unlock(&dev->tx_lock); break; default: Loading Loading @@ -576,15 +575,15 @@ static int ngd_xfer_msg(struct slim_controller *ctrl, struct slim_msg_txn *txn) i, *(pbuf + i)); if (idx < MSM_TX_BUFS) dev->wr_comp[idx] = NULL; /* print BAM debug info for TX pipe */ sps_get_bam_debug_info(dev->bam.hdl, 93, SPS_BAM_PIPE(4), 0, 2); /* * disconnect/recoonect pipe so that subsequent * transactions don't timeout due to unavailable * descriptors */ if (dev->state != MSM_CTRL_DOWN) { /* print BAM debug info for TX pipe */ sps_get_bam_debug_info(dev->bam.hdl, 93, SPS_BAM_PIPE(4), 0, 2); msm_slim_disconnect_endp(dev, &dev->tx_msgq, &dev->use_tx_msgqs); msm_slim_connect_endp(dev, &dev->tx_msgq); Loading Loading @@ -1411,12 +1410,8 @@ static int ngd_notify_slaves(void *data) return 0; } static void ngd_adsp_down(struct work_struct *work) static void ngd_adsp_down(struct msm_slim_ctrl *dev) { struct msm_slim_qmi *qmi = container_of(work, struct msm_slim_qmi, ssr_down); struct msm_slim_ctrl *dev = container_of(qmi, struct msm_slim_ctrl, qmi); struct slim_controller *ctrl = &dev->ctrl; struct slim_device *sbdev; Loading Loading @@ -1667,7 +1662,6 @@ static int ngd_slim_probe(struct platform_device *pdev) dev->ext_mdm.ssr); } INIT_WORK(&dev->qmi.ssr_down, ngd_adsp_down); INIT_WORK(&dev->qmi.ssr_up, ngd_adsp_up); dev->qmi.nb.notifier_call = ngd_qmi_available; pm_runtime_get_noresume(dev->dev); Loading drivers/slimbus/slim-msm.c +51 −8 Original line number Diff line number Diff line Loading @@ -178,7 +178,11 @@ int msm_slim_sps_mem_alloc( void msm_slim_sps_mem_free(struct msm_slim_ctrl *dev, struct sps_mem_buffer *mem) { dma_free_coherent(dev->dev, mem->size, mem->base, mem->phys_base); if (mem->base && mem->phys_base) dma_free_coherent(dev->dev, mem->size, mem->base, mem->phys_base); else dev_err(dev->dev, "cant dma free. they are NULL\n"); mem->size = 0; mem->base = NULL; mem->phys_base = 0; Loading Loading @@ -1039,6 +1043,22 @@ void msm_slim_disconnect_endp(struct msm_slim_ctrl *dev, } } static int msm_slim_discard_rx_data(struct msm_slim_ctrl *dev, struct msm_slim_endp *endpoint) { struct sps_iovec sio; int desc_num = 0, ret = 0; ret = sps_get_unused_desc_num(endpoint->sps, &desc_num); if (ret) { dev_err(dev->dev, "sps_get_iovec() failed 0x%x\n", ret); return ret; } while (desc_num--) sps_get_iovec(endpoint->sps, &sio); return ret; } static void msm_slim_remove_ep(struct msm_slim_ctrl *dev, struct msm_slim_endp *endpoint, enum msm_slim_msgq *msgq_flag) Loading @@ -1046,15 +1066,37 @@ static void msm_slim_remove_ep(struct msm_slim_ctrl *dev, struct sps_connect *config = &endpoint->config; struct sps_mem_buffer *descr = &config->desc; struct sps_mem_buffer *mem = &endpoint->buf; struct sps_register_event sps_event; memset(&sps_event, 0x00, sizeof(sps_event)); msm_slim_sps_mem_free(dev, mem); sps_register_event(endpoint->sps, &sps_event); msm_slim_sps_mem_free(dev, descr); msm_slim_free_endpoint(endpoint); } void msm_slim_deinit_ep(struct msm_slim_ctrl *dev, struct msm_slim_endp *endpoint, enum msm_slim_msgq *msgq_flag) { int ret = 0; struct sps_connect *config = &endpoint->config; if (*msgq_flag == MSM_MSGQ_ENABLED) { if (config->mode == SPS_MODE_SRC) { ret = msm_slim_discard_rx_data(dev, endpoint); if (ret) SLIM_WARN(dev, "discarding Rx data failed\n"); } msm_slim_disconnect_endp(dev, endpoint, msgq_flag); msm_slim_free_endpoint(endpoint); msm_slim_remove_ep(dev, endpoint, msgq_flag); } msm_slim_sps_mem_free(dev, descr); } static void msm_slim_sps_unreg_event(struct sps_pipe *sps) { struct sps_register_event sps_event; memset(&sps_event, 0x00, sizeof(sps_event)); /* Disable interrupt and signal notification for Rx/Tx pipe */ sps_register_event(sps, &sps_event); } void msm_slim_sps_exit(struct msm_slim_ctrl *dev, bool dereg) Loading @@ -1062,9 +1104,10 @@ void msm_slim_sps_exit(struct msm_slim_ctrl *dev, bool dereg) int i; if (dev->use_rx_msgqs >= MSM_MSGQ_ENABLED) msm_slim_remove_ep(dev, &dev->rx_msgq, &dev->use_rx_msgqs); msm_slim_sps_unreg_event(dev->rx_msgq.sps); if (dev->use_tx_msgqs >= MSM_MSGQ_ENABLED) msm_slim_remove_ep(dev, &dev->tx_msgq, &dev->use_tx_msgqs); msm_slim_sps_unreg_event(dev->tx_msgq.sps); for (i = 0; i < dev->port_nums; i++) { if (dev->pipes[i].connected) msm_slim_disconn_pipe_port(dev, i); Loading drivers/slimbus/slim-msm.h +4 −0 Original line number Diff line number Diff line Loading @@ -405,6 +405,10 @@ int msm_slim_connect_endp(struct msm_slim_ctrl *dev, void msm_slim_disconnect_endp(struct msm_slim_ctrl *dev, struct msm_slim_endp *endpoint, enum msm_slim_msgq *msgq_flag); void msm_slim_deinit_ep(struct msm_slim_ctrl *dev, struct msm_slim_endp *endpoint, enum msm_slim_msgq *msgq_flag); void msm_slim_qmi_exit(struct msm_slim_ctrl *dev); int msm_slim_qmi_init(struct msm_slim_ctrl *dev, bool apps_is_master); int msm_slim_qmi_power_request(struct msm_slim_ctrl *dev, bool active); Loading Loading
drivers/slimbus/slim-msm-ctrl.c +10 −1 Original line number Diff line number Diff line /* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved. /* Copyright (c) 2011-2015, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -1390,6 +1390,10 @@ err_request_irq_failed: kthread_stop(dev->rx_msgq_thread); err_thread_create_failed: msm_slim_sps_exit(dev, true); msm_slim_deinit_ep(dev, &dev->rx_msgq, &dev->use_rx_msgqs); msm_slim_deinit_ep(dev, &dev->tx_msgq, &dev->use_tx_msgqs); err_sps_init_failed: if (dev->hclk) { clk_disable_unprepare(dev->hclk); Loading Loading @@ -1435,6 +1439,11 @@ static int msm_slim_remove(struct platform_device *pdev) if (dev->hclk) clk_put(dev->hclk); msm_slim_sps_exit(dev, true); msm_slim_deinit_ep(dev, &dev->rx_msgq, &dev->use_rx_msgqs); msm_slim_deinit_ep(dev, &dev->tx_msgq, &dev->use_tx_msgqs); kthread_stop(dev->rx_msgq_thread); iounmap(dev->bam.base); iounmap(dev->base); Loading
drivers/slimbus/slim-msm-ngd.c +6 −12 Original line number Diff line number Diff line Loading @@ -84,6 +84,7 @@ enum ngd_status { static void ngd_slim_rx(struct msm_slim_ctrl *dev, u8 *buf); static int ngd_slim_runtime_resume(struct device *device); static int ngd_slim_power_up(struct msm_slim_ctrl *dev, bool mdm_restart); static void ngd_adsp_down(struct msm_slim_ctrl *dev); static irqreturn_t ngd_slim_interrupt(int irq, void *d) { Loading Loading @@ -184,15 +185,13 @@ static int dsp_ssr_notify_cb(struct notifier_block *n, unsigned long code, /* make sure autosuspend is not called until ADSP comes up*/ pm_runtime_get_noresume(dev->dev); dev->state = MSM_CTRL_DOWN; /* Reset ctrl_up completion */ init_completion(&dev->ctrl_up); /* disconnect BAM pipes */ if (dev->use_rx_msgqs == MSM_MSGQ_ENABLED) dev->use_rx_msgqs = MSM_MSGQ_DOWN; if (dev->use_tx_msgqs == MSM_MSGQ_ENABLED) dev->use_tx_msgqs = MSM_MSGQ_DOWN; msm_slim_sps_exit(dev, false); schedule_work(&dev->qmi.ssr_down); ngd_adsp_down(dev); mutex_unlock(&dev->tx_lock); break; default: Loading Loading @@ -576,15 +575,15 @@ static int ngd_xfer_msg(struct slim_controller *ctrl, struct slim_msg_txn *txn) i, *(pbuf + i)); if (idx < MSM_TX_BUFS) dev->wr_comp[idx] = NULL; /* print BAM debug info for TX pipe */ sps_get_bam_debug_info(dev->bam.hdl, 93, SPS_BAM_PIPE(4), 0, 2); /* * disconnect/recoonect pipe so that subsequent * transactions don't timeout due to unavailable * descriptors */ if (dev->state != MSM_CTRL_DOWN) { /* print BAM debug info for TX pipe */ sps_get_bam_debug_info(dev->bam.hdl, 93, SPS_BAM_PIPE(4), 0, 2); msm_slim_disconnect_endp(dev, &dev->tx_msgq, &dev->use_tx_msgqs); msm_slim_connect_endp(dev, &dev->tx_msgq); Loading Loading @@ -1411,12 +1410,8 @@ static int ngd_notify_slaves(void *data) return 0; } static void ngd_adsp_down(struct work_struct *work) static void ngd_adsp_down(struct msm_slim_ctrl *dev) { struct msm_slim_qmi *qmi = container_of(work, struct msm_slim_qmi, ssr_down); struct msm_slim_ctrl *dev = container_of(qmi, struct msm_slim_ctrl, qmi); struct slim_controller *ctrl = &dev->ctrl; struct slim_device *sbdev; Loading Loading @@ -1667,7 +1662,6 @@ static int ngd_slim_probe(struct platform_device *pdev) dev->ext_mdm.ssr); } INIT_WORK(&dev->qmi.ssr_down, ngd_adsp_down); INIT_WORK(&dev->qmi.ssr_up, ngd_adsp_up); dev->qmi.nb.notifier_call = ngd_qmi_available; pm_runtime_get_noresume(dev->dev); Loading
drivers/slimbus/slim-msm.c +51 −8 Original line number Diff line number Diff line Loading @@ -178,7 +178,11 @@ int msm_slim_sps_mem_alloc( void msm_slim_sps_mem_free(struct msm_slim_ctrl *dev, struct sps_mem_buffer *mem) { dma_free_coherent(dev->dev, mem->size, mem->base, mem->phys_base); if (mem->base && mem->phys_base) dma_free_coherent(dev->dev, mem->size, mem->base, mem->phys_base); else dev_err(dev->dev, "cant dma free. they are NULL\n"); mem->size = 0; mem->base = NULL; mem->phys_base = 0; Loading Loading @@ -1039,6 +1043,22 @@ void msm_slim_disconnect_endp(struct msm_slim_ctrl *dev, } } static int msm_slim_discard_rx_data(struct msm_slim_ctrl *dev, struct msm_slim_endp *endpoint) { struct sps_iovec sio; int desc_num = 0, ret = 0; ret = sps_get_unused_desc_num(endpoint->sps, &desc_num); if (ret) { dev_err(dev->dev, "sps_get_iovec() failed 0x%x\n", ret); return ret; } while (desc_num--) sps_get_iovec(endpoint->sps, &sio); return ret; } static void msm_slim_remove_ep(struct msm_slim_ctrl *dev, struct msm_slim_endp *endpoint, enum msm_slim_msgq *msgq_flag) Loading @@ -1046,15 +1066,37 @@ static void msm_slim_remove_ep(struct msm_slim_ctrl *dev, struct sps_connect *config = &endpoint->config; struct sps_mem_buffer *descr = &config->desc; struct sps_mem_buffer *mem = &endpoint->buf; struct sps_register_event sps_event; memset(&sps_event, 0x00, sizeof(sps_event)); msm_slim_sps_mem_free(dev, mem); sps_register_event(endpoint->sps, &sps_event); msm_slim_sps_mem_free(dev, descr); msm_slim_free_endpoint(endpoint); } void msm_slim_deinit_ep(struct msm_slim_ctrl *dev, struct msm_slim_endp *endpoint, enum msm_slim_msgq *msgq_flag) { int ret = 0; struct sps_connect *config = &endpoint->config; if (*msgq_flag == MSM_MSGQ_ENABLED) { if (config->mode == SPS_MODE_SRC) { ret = msm_slim_discard_rx_data(dev, endpoint); if (ret) SLIM_WARN(dev, "discarding Rx data failed\n"); } msm_slim_disconnect_endp(dev, endpoint, msgq_flag); msm_slim_free_endpoint(endpoint); msm_slim_remove_ep(dev, endpoint, msgq_flag); } msm_slim_sps_mem_free(dev, descr); } static void msm_slim_sps_unreg_event(struct sps_pipe *sps) { struct sps_register_event sps_event; memset(&sps_event, 0x00, sizeof(sps_event)); /* Disable interrupt and signal notification for Rx/Tx pipe */ sps_register_event(sps, &sps_event); } void msm_slim_sps_exit(struct msm_slim_ctrl *dev, bool dereg) Loading @@ -1062,9 +1104,10 @@ void msm_slim_sps_exit(struct msm_slim_ctrl *dev, bool dereg) int i; if (dev->use_rx_msgqs >= MSM_MSGQ_ENABLED) msm_slim_remove_ep(dev, &dev->rx_msgq, &dev->use_rx_msgqs); msm_slim_sps_unreg_event(dev->rx_msgq.sps); if (dev->use_tx_msgqs >= MSM_MSGQ_ENABLED) msm_slim_remove_ep(dev, &dev->tx_msgq, &dev->use_tx_msgqs); msm_slim_sps_unreg_event(dev->tx_msgq.sps); for (i = 0; i < dev->port_nums; i++) { if (dev->pipes[i].connected) msm_slim_disconn_pipe_port(dev, i); Loading
drivers/slimbus/slim-msm.h +4 −0 Original line number Diff line number Diff line Loading @@ -405,6 +405,10 @@ int msm_slim_connect_endp(struct msm_slim_ctrl *dev, void msm_slim_disconnect_endp(struct msm_slim_ctrl *dev, struct msm_slim_endp *endpoint, enum msm_slim_msgq *msgq_flag); void msm_slim_deinit_ep(struct msm_slim_ctrl *dev, struct msm_slim_endp *endpoint, enum msm_slim_msgq *msgq_flag); void msm_slim_qmi_exit(struct msm_slim_ctrl *dev); int msm_slim_qmi_init(struct msm_slim_ctrl *dev, bool apps_is_master); int msm_slim_qmi_power_request(struct msm_slim_ctrl *dev, bool active); Loading