Loading asoc/codecs/wcd-dsp-mgr.c +33 −6 Original line number Diff line number Diff line /* * Copyright (c) 2016-2017, The Linux Foundation. All rights reserved. * Copyright (c) 2016-2018, 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 @@ -839,21 +839,20 @@ static int wdsp_ssr_handler(struct wdsp_mgr_priv *wdsp, void *arg, } #ifdef CONFIG_DEBUG_FS static int wdsp_debug_dump_handler(struct wdsp_mgr_priv *wdsp, void *arg) static int __wdsp_dbg_dump_locked(struct wdsp_mgr_priv *wdsp, void *arg) { struct wdsp_err_signal_arg *err_data; int ret = 0; WDSP_MGR_MUTEX_LOCK(wdsp, wdsp->ssr_mutex); /* If there is no SSR, set the SSR type to collect ramdumps */ if (wdsp->ssr_type == WDSP_SSR_TYPE_NO_SSR) { wdsp->ssr_type = WDSP_SSR_TYPE_WDSP_DOWN; } else { WDSP_DBG(wdsp, "SSR handling is running, skip debug ramdump"); ret = 0; WDSP_MGR_MUTEX_UNLOCK(wdsp, wdsp->ssr_mutex); goto done; } if (arg) { err_data = (struct wdsp_err_signal_arg *) arg; memcpy(&wdsp->dump_data.err_data, err_data, Loading @@ -861,16 +860,29 @@ static int wdsp_debug_dump_handler(struct wdsp_mgr_priv *wdsp, void *arg) } else { WDSP_DBG(wdsp, "Invalid input, arg is NULL"); ret = -EINVAL; WDSP_MGR_MUTEX_UNLOCK(wdsp, wdsp->ssr_mutex); goto done; } wdsp_collect_ramdumps(wdsp); wdsp->ssr_type = WDSP_SSR_TYPE_NO_SSR; WDSP_MGR_MUTEX_UNLOCK(wdsp, wdsp->ssr_mutex); done: return ret; } static int wdsp_debug_dump_handler(struct wdsp_mgr_priv *wdsp, void *arg) { int ret = 0; WDSP_MGR_MUTEX_LOCK(wdsp, wdsp->ssr_mutex); ret = __wdsp_dbg_dump_locked(wdsp, arg); WDSP_MGR_MUTEX_UNLOCK(wdsp, wdsp->ssr_mutex); return ret; } #else static int __wdsp_dbg_dump_locked(struct wdsp_mgr_priv *wdsp, void *arg) { return 0; } static int wdsp_debug_dump_handler(struct wdsp_mgr_priv *wdsp, void *arg) { return 0; Loading @@ -887,7 +899,13 @@ static int wdsp_signal_handler(struct device *wdsp_dev, return -EINVAL; wdsp = dev_get_drvdata(wdsp_dev); #ifdef CONFIG_DEBUG_FS if (signal != WDSP_DEBUG_DUMP_INTERNAL) WDSP_MGR_MUTEX_LOCK(wdsp, wdsp->api_mutex); #else WDSP_MGR_MUTEX_LOCK(wdsp, wdsp->api_mutex); #endif WDSP_DBG(wdsp, "Raised signal %d", signal); Loading @@ -908,6 +926,9 @@ static int wdsp_signal_handler(struct device *wdsp_dev, case WDSP_DEBUG_DUMP: ret = wdsp_debug_dump_handler(wdsp, arg); break; case WDSP_DEBUG_DUMP_INTERNAL: ret = __wdsp_dbg_dump_locked(wdsp, arg); break; default: ret = -EINVAL; break; Loading @@ -916,7 +937,13 @@ static int wdsp_signal_handler(struct device *wdsp_dev, if (ret < 0) WDSP_ERR(wdsp, "handling signal %d failed with error %d", signal, ret); #ifdef CONFIG_DEBUG_FS if (signal != WDSP_DEBUG_DUMP_INTERNAL) WDSP_MGR_MUTEX_UNLOCK(wdsp, wdsp->api_mutex); #else WDSP_MGR_MUTEX_UNLOCK(wdsp, wdsp->api_mutex); #endif return ret; } Loading asoc/codecs/wcd934x/wcd934x-dsp-cntl.c +10 −6 Original line number Diff line number Diff line Loading @@ -101,6 +101,7 @@ static u16 wdsp_reg_for_debug_dump[] = { WCD934X_CPE_SS_SOC_SW_COLLAPSE_CTL, WCD934X_CPE_SS_MAD_CTL, WCD934X_CPE_SS_CPAR_CTL, WCD934X_CPE_SS_CPAR_CFG, WCD934X_CPE_SS_WDOG_CFG, WCD934X_CPE_SS_STATUS, WCD934X_CPE_SS_SS_ERROR_INT_MASK_0A, Loading @@ -113,10 +114,12 @@ static u16 wdsp_reg_for_debug_dump[] = { WCD934X_CPE_SS_SS_ERROR_INT_STATUS_1B, }; static void wcd_cntl_collect_debug_dumps(struct wcd_dsp_cntl *cntl) static void wcd_cntl_collect_debug_dumps(struct wcd_dsp_cntl *cntl, bool internal) { struct snd_soc_codec *codec = cntl->codec; struct wdsp_err_signal_arg arg; enum wdsp_signal signal; int i; u8 val; Loading Loading @@ -146,8 +149,8 @@ static void wcd_cntl_collect_debug_dumps(struct wcd_dsp_cntl *cntl) arg.mem_dumps_enabled = cntl->ramdump_enable; arg.remote_start_addr = WCD_934X_RAMDUMP_START_ADDR; arg.dump_size = WCD_934X_RAMDUMP_SIZE; cntl->m_ops->signal_handler(cntl->m_dev, WDSP_DEBUG_DUMP, &arg); signal = internal ? WDSP_DEBUG_DUMP_INTERNAL : WDSP_DEBUG_DUMP; cntl->m_ops->signal_handler(cntl->m_dev, signal, &arg); } /* Unmask the fatal irqs */ Loading @@ -161,7 +164,8 @@ static void wcd_cntl_collect_debug_dumps(struct wcd_dsp_cntl *cntl) #else #define WCD_CNTL_SET_ERR_IRQ_FLAG(cntl) 0 #define WCD_CNTL_CLR_ERR_IRQ_FLAG(cntl) do {} while (0) static void wcd_cntl_collect_debug_dumps(struct wcd_dsp_cntl *cntl) static void wcd_cntl_collect_debug_dumps(struct wcd_dsp_cntl *cntl, bool internal) { } #endif Loading Loading @@ -753,7 +757,7 @@ static int wcd_cntl_do_boot(struct wcd_dsp_cntl *cntl) if (!ret) { dev_err(codec->dev, "%s: WDSP boot timed out\n", __func__); wcd_cntl_collect_debug_dumps(cntl); wcd_cntl_collect_debug_dumps(cntl, true); ret = -ETIMEDOUT; goto err_boot; } else { Loading Loading @@ -1041,7 +1045,7 @@ static ssize_t wcd_miscdev_write(struct file *filep, const char __user *ubuf, } else if (!strcmp(val, "DEBUG_DUMP")) { dev_dbg(cntl->codec->dev, "%s: Collect dumps for debug use\n", __func__); wcd_cntl_collect_debug_dumps(cntl); wcd_cntl_collect_debug_dumps(cntl, false); goto done; } else { dev_err(cntl->codec->dev, "%s: Invalid value %s\n", Loading Loading
asoc/codecs/wcd-dsp-mgr.c +33 −6 Original line number Diff line number Diff line /* * Copyright (c) 2016-2017, The Linux Foundation. All rights reserved. * Copyright (c) 2016-2018, 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 @@ -839,21 +839,20 @@ static int wdsp_ssr_handler(struct wdsp_mgr_priv *wdsp, void *arg, } #ifdef CONFIG_DEBUG_FS static int wdsp_debug_dump_handler(struct wdsp_mgr_priv *wdsp, void *arg) static int __wdsp_dbg_dump_locked(struct wdsp_mgr_priv *wdsp, void *arg) { struct wdsp_err_signal_arg *err_data; int ret = 0; WDSP_MGR_MUTEX_LOCK(wdsp, wdsp->ssr_mutex); /* If there is no SSR, set the SSR type to collect ramdumps */ if (wdsp->ssr_type == WDSP_SSR_TYPE_NO_SSR) { wdsp->ssr_type = WDSP_SSR_TYPE_WDSP_DOWN; } else { WDSP_DBG(wdsp, "SSR handling is running, skip debug ramdump"); ret = 0; WDSP_MGR_MUTEX_UNLOCK(wdsp, wdsp->ssr_mutex); goto done; } if (arg) { err_data = (struct wdsp_err_signal_arg *) arg; memcpy(&wdsp->dump_data.err_data, err_data, Loading @@ -861,16 +860,29 @@ static int wdsp_debug_dump_handler(struct wdsp_mgr_priv *wdsp, void *arg) } else { WDSP_DBG(wdsp, "Invalid input, arg is NULL"); ret = -EINVAL; WDSP_MGR_MUTEX_UNLOCK(wdsp, wdsp->ssr_mutex); goto done; } wdsp_collect_ramdumps(wdsp); wdsp->ssr_type = WDSP_SSR_TYPE_NO_SSR; WDSP_MGR_MUTEX_UNLOCK(wdsp, wdsp->ssr_mutex); done: return ret; } static int wdsp_debug_dump_handler(struct wdsp_mgr_priv *wdsp, void *arg) { int ret = 0; WDSP_MGR_MUTEX_LOCK(wdsp, wdsp->ssr_mutex); ret = __wdsp_dbg_dump_locked(wdsp, arg); WDSP_MGR_MUTEX_UNLOCK(wdsp, wdsp->ssr_mutex); return ret; } #else static int __wdsp_dbg_dump_locked(struct wdsp_mgr_priv *wdsp, void *arg) { return 0; } static int wdsp_debug_dump_handler(struct wdsp_mgr_priv *wdsp, void *arg) { return 0; Loading @@ -887,7 +899,13 @@ static int wdsp_signal_handler(struct device *wdsp_dev, return -EINVAL; wdsp = dev_get_drvdata(wdsp_dev); #ifdef CONFIG_DEBUG_FS if (signal != WDSP_DEBUG_DUMP_INTERNAL) WDSP_MGR_MUTEX_LOCK(wdsp, wdsp->api_mutex); #else WDSP_MGR_MUTEX_LOCK(wdsp, wdsp->api_mutex); #endif WDSP_DBG(wdsp, "Raised signal %d", signal); Loading @@ -908,6 +926,9 @@ static int wdsp_signal_handler(struct device *wdsp_dev, case WDSP_DEBUG_DUMP: ret = wdsp_debug_dump_handler(wdsp, arg); break; case WDSP_DEBUG_DUMP_INTERNAL: ret = __wdsp_dbg_dump_locked(wdsp, arg); break; default: ret = -EINVAL; break; Loading @@ -916,7 +937,13 @@ static int wdsp_signal_handler(struct device *wdsp_dev, if (ret < 0) WDSP_ERR(wdsp, "handling signal %d failed with error %d", signal, ret); #ifdef CONFIG_DEBUG_FS if (signal != WDSP_DEBUG_DUMP_INTERNAL) WDSP_MGR_MUTEX_UNLOCK(wdsp, wdsp->api_mutex); #else WDSP_MGR_MUTEX_UNLOCK(wdsp, wdsp->api_mutex); #endif return ret; } Loading
asoc/codecs/wcd934x/wcd934x-dsp-cntl.c +10 −6 Original line number Diff line number Diff line Loading @@ -101,6 +101,7 @@ static u16 wdsp_reg_for_debug_dump[] = { WCD934X_CPE_SS_SOC_SW_COLLAPSE_CTL, WCD934X_CPE_SS_MAD_CTL, WCD934X_CPE_SS_CPAR_CTL, WCD934X_CPE_SS_CPAR_CFG, WCD934X_CPE_SS_WDOG_CFG, WCD934X_CPE_SS_STATUS, WCD934X_CPE_SS_SS_ERROR_INT_MASK_0A, Loading @@ -113,10 +114,12 @@ static u16 wdsp_reg_for_debug_dump[] = { WCD934X_CPE_SS_SS_ERROR_INT_STATUS_1B, }; static void wcd_cntl_collect_debug_dumps(struct wcd_dsp_cntl *cntl) static void wcd_cntl_collect_debug_dumps(struct wcd_dsp_cntl *cntl, bool internal) { struct snd_soc_codec *codec = cntl->codec; struct wdsp_err_signal_arg arg; enum wdsp_signal signal; int i; u8 val; Loading Loading @@ -146,8 +149,8 @@ static void wcd_cntl_collect_debug_dumps(struct wcd_dsp_cntl *cntl) arg.mem_dumps_enabled = cntl->ramdump_enable; arg.remote_start_addr = WCD_934X_RAMDUMP_START_ADDR; arg.dump_size = WCD_934X_RAMDUMP_SIZE; cntl->m_ops->signal_handler(cntl->m_dev, WDSP_DEBUG_DUMP, &arg); signal = internal ? WDSP_DEBUG_DUMP_INTERNAL : WDSP_DEBUG_DUMP; cntl->m_ops->signal_handler(cntl->m_dev, signal, &arg); } /* Unmask the fatal irqs */ Loading @@ -161,7 +164,8 @@ static void wcd_cntl_collect_debug_dumps(struct wcd_dsp_cntl *cntl) #else #define WCD_CNTL_SET_ERR_IRQ_FLAG(cntl) 0 #define WCD_CNTL_CLR_ERR_IRQ_FLAG(cntl) do {} while (0) static void wcd_cntl_collect_debug_dumps(struct wcd_dsp_cntl *cntl) static void wcd_cntl_collect_debug_dumps(struct wcd_dsp_cntl *cntl, bool internal) { } #endif Loading Loading @@ -753,7 +757,7 @@ static int wcd_cntl_do_boot(struct wcd_dsp_cntl *cntl) if (!ret) { dev_err(codec->dev, "%s: WDSP boot timed out\n", __func__); wcd_cntl_collect_debug_dumps(cntl); wcd_cntl_collect_debug_dumps(cntl, true); ret = -ETIMEDOUT; goto err_boot; } else { Loading Loading @@ -1041,7 +1045,7 @@ static ssize_t wcd_miscdev_write(struct file *filep, const char __user *ubuf, } else if (!strcmp(val, "DEBUG_DUMP")) { dev_dbg(cntl->codec->dev, "%s: Collect dumps for debug use\n", __func__); wcd_cntl_collect_debug_dumps(cntl); wcd_cntl_collect_debug_dumps(cntl, false); goto done; } else { dev_err(cntl->codec->dev, "%s: Invalid value %s\n", Loading