Merge "codecs: Enable clock voting logs to debug AHB/NOC issues"
This commit is contained in:

committed by
Gerrit - the friendly Code Review server

commit
286b657ee7
@@ -479,6 +479,8 @@ static int swrm_clk_request(struct swr_mstr_ctrl *swrm, bool enable)
|
||||
}
|
||||
swrm->clk_ref_count++;
|
||||
if (swrm->clk_ref_count == 1) {
|
||||
trace_printk("%s: clock enable count %d",
|
||||
__func__, swrm->clk_ref_count);
|
||||
ret = swrm->clk(swrm->handle, true);
|
||||
if (ret) {
|
||||
dev_err_ratelimited(swrm->dev,
|
||||
@@ -488,6 +490,8 @@ static int swrm_clk_request(struct swr_mstr_ctrl *swrm, bool enable)
|
||||
}
|
||||
}
|
||||
} else if (--swrm->clk_ref_count == 0) {
|
||||
trace_printk("%s: clock disable count %d",
|
||||
__func__, swrm->clk_ref_count);
|
||||
swrm->clk(swrm->handle, false);
|
||||
complete(&swrm->clk_off_complete);
|
||||
}
|
||||
@@ -1738,6 +1742,7 @@ static irqreturn_t swr_mstr_interrupt(int irq, void *dev)
|
||||
struct swr_master *mstr = &swrm->master;
|
||||
int retry = 5;
|
||||
|
||||
trace_printk("%s enter\n", __func__);
|
||||
if (unlikely(swrm_lock_sleep(swrm) == false)) {
|
||||
dev_err(swrm->dev, "%s Failed to hold suspend\n", __func__);
|
||||
return IRQ_NONE;
|
||||
@@ -1764,6 +1769,7 @@ static irqreturn_t swr_mstr_interrupt(int irq, void *dev)
|
||||
intr_sts_masked = intr_sts & swrm->intr_mask;
|
||||
|
||||
dev_dbg(swrm->dev, "%s: status: 0x%x \n", __func__, intr_sts_masked);
|
||||
trace_printk("%s: status: 0x%x \n", __func__, intr_sts_masked);
|
||||
handle_irq:
|
||||
for (i = 0; i < SWRM_INTERRUPT_MAX; i++) {
|
||||
value = intr_sts_masked & (1 << i);
|
||||
@@ -1967,6 +1973,7 @@ err_audio_hw_vote:
|
||||
exit:
|
||||
mutex_unlock(&swrm->reslock);
|
||||
swrm_unlock_sleep(swrm);
|
||||
trace_printk("%s exit\n", __func__);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1980,6 +1987,7 @@ static irqreturn_t swrm_wakeup_interrupt(int irq, void *dev)
|
||||
return IRQ_NONE;
|
||||
}
|
||||
|
||||
trace_printk("%s enter\n", __func__);
|
||||
mutex_lock(&swrm->devlock);
|
||||
if (!swrm->dev_up) {
|
||||
if (swrm->wake_irq > 0) {
|
||||
@@ -2018,6 +2026,7 @@ static irqreturn_t swrm_wakeup_interrupt(int irq, void *dev)
|
||||
pm_runtime_put_autosuspend(swrm->dev);
|
||||
swrm_unlock_sleep(swrm);
|
||||
exit:
|
||||
trace_printk("%s exit\n", __func__);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -2032,6 +2041,7 @@ static void swrm_wakeup_work(struct work_struct *work)
|
||||
return;
|
||||
}
|
||||
|
||||
trace_printk("%s enter\n", __func__);
|
||||
mutex_lock(&swrm->devlock);
|
||||
if (!swrm->dev_up) {
|
||||
mutex_unlock(&swrm->devlock);
|
||||
@@ -2047,6 +2057,7 @@ static void swrm_wakeup_work(struct work_struct *work)
|
||||
pm_runtime_put_autosuspend(swrm->dev);
|
||||
swrm_unlock_sleep(swrm);
|
||||
exit:
|
||||
trace_printk("%s exit\n", __func__);
|
||||
pm_relax(swrm->dev);
|
||||
}
|
||||
|
||||
@@ -2151,6 +2162,8 @@ static void swrm_device_wakeup_vote(struct swr_master *mstr)
|
||||
}
|
||||
dev_dbg(swrm->dev, "%s: hw_clk_en: %d audio_core_clk_en: %d\n",
|
||||
__func__, swrm->hw_core_clk_en, swrm->aud_core_clk_en);
|
||||
trace_printk("%s: hw_clk_en: %d audio_core_clk_en: %d\n",
|
||||
__func__, swrm->hw_core_clk_en, swrm->aud_core_clk_en);
|
||||
pm_runtime_get_sync(swrm->dev);
|
||||
}
|
||||
|
||||
@@ -2168,6 +2181,8 @@ static void swrm_device_wakeup_unvote(struct swr_master *mstr)
|
||||
dev_dbg(swrm->dev, "%s: hw_clk_en: %d audio_core_clk_en: %d\n",
|
||||
__func__, swrm->hw_core_clk_en, swrm->aud_core_clk_en);
|
||||
|
||||
trace_printk("%s: hw_clk_en: %d audio_core_clk_en: %d\n",
|
||||
__func__, swrm->hw_core_clk_en, swrm->aud_core_clk_en);
|
||||
--swrm->aud_core_clk_en;
|
||||
if (swrm->aud_core_clk_en < 0)
|
||||
swrm->aud_core_clk_en = 0;
|
||||
@@ -2734,6 +2749,8 @@ static int swrm_runtime_resume(struct device *dev)
|
||||
|
||||
dev_dbg(dev, "%s: pm_runtime: resume, state:%d\n",
|
||||
__func__, swrm->state);
|
||||
trace_printk("%s: pm_runtime: resume, state:%d\n",
|
||||
__func__, swrm->state);
|
||||
mutex_lock(&swrm->reslock);
|
||||
|
||||
if (swrm_request_hw_vote(swrm, LPASS_HW_CORE, true)) {
|
||||
@@ -2784,6 +2801,9 @@ static int swrm_runtime_resume(struct device *dev)
|
||||
dev_dbg(dev,
|
||||
"%s slave device up not implemented\n",
|
||||
__func__);
|
||||
trace_printk(
|
||||
"%s slave device up not implemented\n",
|
||||
__func__);
|
||||
ret = 0;
|
||||
} else if (ret) {
|
||||
dev_err(dev,
|
||||
@@ -2845,6 +2865,8 @@ exit:
|
||||
auto_suspend_timer);
|
||||
mutex_unlock(&swrm->reslock);
|
||||
|
||||
trace_printk("%s: pm_runtime: resume done, state:%d\n",
|
||||
__func__, swrm->state);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -2859,6 +2881,8 @@ static int swrm_runtime_suspend(struct device *dev)
|
||||
struct swr_device *swr_dev;
|
||||
int current_state = 0;
|
||||
|
||||
trace_printk("%s: pm_runtime: suspend state: %d\n",
|
||||
__func__, swrm->state);
|
||||
dev_dbg(dev, "%s: pm_runtime: suspend state: %d\n",
|
||||
__func__, swrm->state);
|
||||
mutex_lock(&swrm->reslock);
|
||||
@@ -2883,10 +2907,13 @@ static int swrm_runtime_suspend(struct device *dev)
|
||||
if ((current_state != SWR_MSTR_SSR) &&
|
||||
swrm_is_port_en(&swrm->master)) {
|
||||
dev_dbg(dev, "%s ports are enabled\n", __func__);
|
||||
trace_printk("%s ports are enabled\n", __func__);
|
||||
ret = -EBUSY;
|
||||
goto exit;
|
||||
}
|
||||
if (!swrm->clk_stop_mode0_supp || swrm->state == SWR_MSTR_SSR) {
|
||||
dev_err(dev, "%s: clk stop mode not supported or SSR entry\n",
|
||||
__func__);
|
||||
mutex_unlock(&swrm->reslock);
|
||||
enable_bank_switch(swrm, 0, SWR_ROW_50, SWR_MIN_COL);
|
||||
mutex_lock(&swrm->reslock);
|
||||
@@ -2897,15 +2924,23 @@ static int swrm_runtime_suspend(struct device *dev)
|
||||
if (ret == -ENODEV) {
|
||||
dev_dbg_ratelimited(dev,
|
||||
"%s slave device down not implemented\n",
|
||||
__func__);
|
||||
__func__);
|
||||
trace_printk(
|
||||
"%s slave device down not implemented\n",
|
||||
__func__);
|
||||
ret = 0;
|
||||
} else if (ret) {
|
||||
dev_err(dev,
|
||||
"%s: failed to shutdown swr dev %d\n",
|
||||
__func__, swr_dev->dev_num);
|
||||
trace_printk(
|
||||
"%s: failed to shutdown swr dev %d\n",
|
||||
__func__, swr_dev->dev_num);
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
trace_printk("%s: clk stop mode not supported or SSR exit\n",
|
||||
__func__);
|
||||
} else {
|
||||
/* Mask bus clash interrupt */
|
||||
swrm->intr_mask &= ~((u32)0x08);
|
||||
@@ -2951,6 +2986,8 @@ exit:
|
||||
if (!hw_core_err)
|
||||
swrm_request_hw_vote(swrm, LPASS_HW_CORE, false);
|
||||
mutex_unlock(&swrm->reslock);
|
||||
trace_printk("%s: pm_runtime: suspend done state: %d\n",
|
||||
__func__, swrm->state);
|
||||
return ret;
|
||||
}
|
||||
#endif /* CONFIG_PM */
|
||||
@@ -2962,6 +2999,7 @@ static int swrm_device_suspend(struct device *dev)
|
||||
int ret = 0;
|
||||
|
||||
dev_dbg(dev, "%s: swrm state: %d\n", __func__, swrm->state);
|
||||
trace_printk("%s: swrm state: %d\n", __func__, swrm->state);
|
||||
if (!pm_runtime_enabled(dev) || !pm_runtime_suspended(dev)) {
|
||||
ret = swrm_runtime_suspend(dev);
|
||||
if (!ret) {
|
||||
@@ -2980,6 +3018,7 @@ static int swrm_device_down(struct device *dev)
|
||||
struct swr_mstr_ctrl *swrm = platform_get_drvdata(pdev);
|
||||
|
||||
dev_dbg(dev, "%s: swrm state: %d\n", __func__, swrm->state);
|
||||
trace_printk("%s: swrm state: %d\n", __func__, swrm->state);
|
||||
|
||||
mutex_lock(&swrm->force_down_lock);
|
||||
swrm->state = SWR_MSTR_SSR;
|
||||
@@ -3153,6 +3192,7 @@ int swrm_wcd_notify(struct platform_device *pdev, u32 id, void *data)
|
||||
}
|
||||
break;
|
||||
case SWR_DEVICE_SSR_DOWN:
|
||||
trace_printk("%s: swr device down called\n", __func__);
|
||||
mutex_lock(&swrm->devlock);
|
||||
swrm->dev_up = false;
|
||||
mutex_unlock(&swrm->devlock);
|
||||
@@ -3162,6 +3202,7 @@ int swrm_wcd_notify(struct platform_device *pdev, u32 id, void *data)
|
||||
break;
|
||||
case SWR_DEVICE_SSR_UP:
|
||||
/* wait for clk voting to be zero */
|
||||
trace_printk("%s: swr device up called\n", __func__);
|
||||
reinit_completion(&swrm->clk_off_complete);
|
||||
if (swrm->clk_ref_count &&
|
||||
!wait_for_completion_timeout(&swrm->clk_off_complete,
|
||||
@@ -3175,6 +3216,7 @@ int swrm_wcd_notify(struct platform_device *pdev, u32 id, void *data)
|
||||
break;
|
||||
case SWR_DEVICE_DOWN:
|
||||
dev_dbg(swrm->dev, "%s: swr master down called\n", __func__);
|
||||
trace_printk("%s: swr master down called\n", __func__);
|
||||
mutex_lock(&swrm->mlock);
|
||||
if (swrm->state == SWR_MSTR_DOWN)
|
||||
dev_dbg(swrm->dev, "%s:SWR master is already Down:%d\n",
|
||||
@@ -3185,6 +3227,7 @@ int swrm_wcd_notify(struct platform_device *pdev, u32 id, void *data)
|
||||
break;
|
||||
case SWR_DEVICE_UP:
|
||||
dev_dbg(swrm->dev, "%s: swr master up called\n", __func__);
|
||||
trace_printk("%s: swr master up called\n", __func__);
|
||||
mutex_lock(&swrm->devlock);
|
||||
if (!swrm->dev_up) {
|
||||
dev_dbg(swrm->dev, "SSR not complete yet\n");
|
||||
|
Reference in New Issue
Block a user