sound: samsung/abox: also allow disabling abox_debug

Affected by CONFIG_SND_SOC_SAMSUNG_DEBUG.

Signed-off-by: Nahuel Gómez <nahuelgomez329@gmail.com>
This commit is contained in:
Nahuel Gómez 2025-01-20 19:28:16 -03:00 committed by Ksawlii
parent f8342c269f
commit 41b2ee9adb
5 changed files with 37 additions and 1 deletions

View file

@ -21,11 +21,15 @@ snd-soc-samsung-abox-gic-$(CONFIG_SND_SOC_SAMSUNG_ABOX) += abox_gic.o abox_util.
snd-soc-samsung-abox-sync-$(CONFIG_SEC_SND_SYNCHRONIZED_IPC) += abox_synchronized_ipc.o snd-soc-samsung-abox-sync-$(CONFIG_SEC_SND_SYNCHRONIZED_IPC) += abox_synchronized_ipc.o
snd-soc-samsung-abox-$(CONFIG_SND_SOC_SAMSUNG_ABOX) += abox_util.o \ snd-soc-samsung-abox-$(CONFIG_SND_SOC_SAMSUNG_ABOX) += abox_util.o \
abox_dbg.o abox_dump.o abox_log.o abox.o abox_core.o abox_rdma.o\ abox_dump.o abox_log.o abox.o abox_core.o abox_rdma.o\
abox_wdma.o abox_if.o abox_effect.o abox_vss.o abox_failsafe.o \ abox_wdma.o abox_if.o abox_effect.o abox_vss.o abox_failsafe.o \
abox_vdma.o abox_msg.o abox_ipc.o abox_qos.o abox_ion.o abox_tplg.o \ abox_vdma.o abox_msg.o abox_ipc.o abox_qos.o abox_ion.o abox_tplg.o \
abox_dma.o abox_pci.o abox_shm.o abox_atune.o abox_proc.o abox_oem.o abox_dma.o abox_pci.o abox_shm.o abox_atune.o abox_proc.o abox_oem.o
ifeq ($(CONFIG_SND_SOC_SAMSUNG_DEBUG),y)
snd-soc-samsung-abox-$(CONFIG_SND_SOC_SAMSUNG_ABOX) += abox_dbg.o
endif
obj-$(CONFIG_SND_SOC_SAMSUNG_ABOX) += snd-soc-samsung-abox-gic.o snd-soc-samsung-abox.o obj-$(CONFIG_SND_SOC_SAMSUNG_ABOX) += snd-soc-samsung-abox-gic.o snd-soc-samsung-abox.o
obj-$(CONFIG_SEC_SND_SYNCHRONIZED_IPC) += snd-soc-samsung-abox-sync.o obj-$(CONFIG_SEC_SND_SYNCHRONIZED_IPC) += snd-soc-samsung-abox-sync.o

View file

@ -118,9 +118,11 @@ struct abox_data *abox_get_data(struct device *dev)
static int abox_iommu_fault_handler(struct iommu_fault *fault, void *token) static int abox_iommu_fault_handler(struct iommu_fault *fault, void *token)
{ {
#ifdef CONFIG_SND_SOC_SAMSUNG_DEBUG
struct abox_data *data = token; struct abox_data *data = token;
abox_dbg_print_gpr(data->dev, data); abox_dbg_print_gpr(data->dev, data);
#endif
return 0; return 0;
} }
@ -150,14 +152,18 @@ static void exynos_abox_panic_handler(void)
} }
has_run = true; has_run = true;
#ifdef CONFIG_SND_SOC_SAMSUNG_DEBUG
abox_dbg_dump_gpr(dev, data, ABOX_DBG_DUMP_KERNEL, "panic"); abox_dbg_dump_gpr(dev, data, ABOX_DBG_DUMP_KERNEL, "panic");
#endif
abox_set_magic(data, 0x504E4943); abox_set_magic(data, 0x504E4943);
abox_cpu_enable(false); abox_cpu_enable(false);
abox_cpu_power(false); abox_cpu_power(false);
abox_cpu_power(true); abox_cpu_power(true);
abox_cpu_enable(true); abox_cpu_enable(true);
mdelay(100); mdelay(100);
#ifdef CONFIG_SND_SOC_SAMSUNG_DEBUG
abox_dbg_dump_mem(dev, data, ABOX_DBG_DUMP_KERNEL, "panic"); abox_dbg_dump_mem(dev, data, ABOX_DBG_DUMP_KERNEL, "panic");
#endif
} else { } else {
abox_info(dev, "%s: dump is skipped due to no power\n", abox_info(dev, "%s: dump is skipped due to no power\n",
__func__); __func__);
@ -184,8 +190,10 @@ static void abox_wdt_work_func(struct work_struct *work)
wdt_work); wdt_work);
struct device *dev_abox = data->dev; struct device *dev_abox = data->dev;
#ifdef CONFIG_SND_SOC_SAMSUNG_DEBUG
abox_dbg_print_gpr(dev_abox, data); abox_dbg_print_gpr(dev_abox, data);
abox_dbg_dump_mem(dev_abox, data, ABOX_DBG_DUMP_KERNEL, "watchdog"); abox_dbg_dump_mem(dev_abox, data, ABOX_DBG_DUMP_KERNEL, "watchdog");
#endif
abox_failsafe_report(dev_abox, true); abox_failsafe_report(dev_abox, true);
} }
@ -199,7 +207,9 @@ static irqreturn_t abox_wdt_handler(int irq, void *dev_id)
abox_err(dev, "abox watchdog timeout\n"); abox_err(dev, "abox watchdog timeout\n");
if (abox_is_on()) { if (abox_is_on()) {
#ifdef CONFIG_SND_SOC_SAMSUNG_DEBUG
abox_dbg_dump_gpr(dev, data, ABOX_DBG_DUMP_KERNEL, "watchdog"); abox_dbg_dump_gpr(dev, data, ABOX_DBG_DUMP_KERNEL, "watchdog");
#endif
writel(0x504E4943, data->sram_base + SRAM_FIRMWARE_SIZE - writel(0x504E4943, data->sram_base + SRAM_FIRMWARE_SIZE -
sizeof(u32)); sizeof(u32));
abox_cpu_enable(false); abox_cpu_enable(false);
@ -1148,8 +1158,10 @@ static int abox_check_dram_status(struct device *dev, struct abox_data *data,
val &= ABOX_SYSPOWER_STATUS_MASK; val &= ABOX_SYSPOWER_STATUS_MASK;
if (local_clock() > timeout) { if (local_clock() > timeout) {
abox_warn(dev, "syspower status timeout: %u\n", val); abox_warn(dev, "syspower status timeout: %u\n", val);
#ifdef CONFIG_SND_SOC_SAMSUNG_DEBUG
abox_dbg_dump_simple(dev, data, abox_dbg_dump_simple(dev, data,
"syspower status timeout"); "syspower status timeout");
#endif
ret = -EPERM; ret = -EPERM;
break; break;
} }
@ -2380,21 +2392,25 @@ static void abox_system_ipc_handler(struct device *dev,
system_msg->bundle.param_s32[1]); system_msg->bundle.param_s32[1]);
area = abox_addr_to_kernel_addr(data, area = abox_addr_to_kernel_addr(data,
system_msg->bundle.param_s32[0]); system_msg->bundle.param_s32[0]);
#ifdef CONFIG_SND_SOC_SAMSUNG_DEBUG
abox_dbg_print_gpr_from_addr(dev, data, area); abox_dbg_print_gpr_from_addr(dev, data, area);
abox_dbg_dump_gpr_from_addr(dev, data, area, abox_dbg_dump_gpr_from_addr(dev, data, area,
ABOX_DBG_DUMP_FIRMWARE, type); ABOX_DBG_DUMP_FIRMWARE, type);
abox_dbg_dump_mem(dev, data, ABOX_DBG_DUMP_FIRMWARE, abox_dbg_dump_mem(dev, data, ABOX_DBG_DUMP_FIRMWARE,
type); type);
#endif
break; break;
default: default:
abox_err(dev, "%s(%#x, %#x, %#x) is reported from calliope\n", abox_err(dev, "%s(%#x, %#x, %#x) is reported from calliope\n",
type, system_msg->param1, type, system_msg->param1,
system_msg->param2, system_msg->param3); system_msg->param2, system_msg->param3);
#ifdef CONFIG_SND_SOC_SAMSUNG_DEBUG
abox_dbg_print_gpr(dev, data); abox_dbg_print_gpr(dev, data);
abox_dbg_dump_gpr(dev, data, ABOX_DBG_DUMP_FIRMWARE, abox_dbg_dump_gpr(dev, data, ABOX_DBG_DUMP_FIRMWARE,
type); type);
abox_dbg_dump_mem(dev, data, ABOX_DBG_DUMP_FIRMWARE, abox_dbg_dump_mem(dev, data, ABOX_DBG_DUMP_FIRMWARE,
type); type);
#endif
break; break;
} }
#if IS_ENABLED(CONFIG_SND_SOC_SAMSUNG_DEBUG) #if IS_ENABLED(CONFIG_SND_SOC_SAMSUNG_DEBUG)
@ -3514,8 +3530,10 @@ static int abox_disable(struct device *dev)
clk_disable(data->clk_cpu); clk_disable(data->clk_cpu);
abox_gic_disable_irq(data->dev_gic); abox_gic_disable_irq(data->dev_gic);
abox_failsafe_report_reset(dev); abox_failsafe_report_reset(dev);
#ifdef CONFIG_SND_SOC_SAMSUNG_DEBUG
if (data->debug_mode != DEBUG_MODE_NONE) if (data->debug_mode != DEBUG_MODE_NONE)
abox_dbg_dump_suspend(dev, data); abox_dbg_dump_suspend(dev, data);
#endif
abox_power_notifier_call_chain(data, false); abox_power_notifier_call_chain(data, false);
abox_cleanup(data); abox_cleanup(data);
abox_set_minimum_stable_qos(data, false); abox_set_minimum_stable_qos(data, false);
@ -3644,7 +3662,9 @@ int abox_notify_modem_event(enum abox_modem_event event)
case ABOX_MODEM_EVENT_EXIT: case ABOX_MODEM_EVENT_EXIT:
system_msg->msgtype = ABOX_STOP_VSS; system_msg->msgtype = ABOX_STOP_VSS;
if (abox_is_on()) { if (abox_is_on()) {
#ifdef CONFIG_SND_SOC_SAMSUNG_DEBUG
abox_dbg_print_gpr(dev, data); abox_dbg_print_gpr(dev, data);
#endif
abox_failsafe_report(dev, false); abox_failsafe_report(dev, false);
} }
break; break;
@ -3688,9 +3708,11 @@ static int abox_itmon_notifier(struct notifier_block *nb,
if (itmon_data->port && strstr(itmon_data->port, keyword)) { if (itmon_data->port && strstr(itmon_data->port, keyword)) {
abox_info(dev, "%s(%lu)\n", __func__, action); abox_info(dev, "%s(%lu)\n", __func__, action);
#ifdef CONFIG_SND_SOC_SAMSUNG_DEBUG
abox_dbg_print_gpr(dev, data); abox_dbg_print_gpr(dev, data);
abox_dbg_dump_gpr(dev, data, ABOX_DBG_DUMP_KERNEL, "itmon"); abox_dbg_dump_gpr(dev, data, ABOX_DBG_DUMP_KERNEL, "itmon");
abox_dbg_dump_mem(dev, data, ABOX_DBG_DUMP_KERNEL, "itmon"); abox_dbg_dump_mem(dev, data, ABOX_DBG_DUMP_KERNEL, "itmon");
#endif
data->enabled = false; data->enabled = false;
return NOTIFY_BAD; return NOTIFY_BAD;
} }
@ -3940,7 +3962,9 @@ static void abox_sysevent_register(struct abox_data *data)
/* sub-driver list */ /* sub-driver list */
static struct platform_driver *abox_sub_drivers[] = { static struct platform_driver *abox_sub_drivers[] = {
#ifdef CONFIG_SND_SOC_SAMSUNG_DEBUG
&samsung_abox_debug_driver, &samsung_abox_debug_driver,
#endif
&samsung_abox_pci_driver, &samsung_abox_pci_driver,
&samsung_abox_core_driver, &samsung_abox_core_driver,
&samsung_abox_dump_driver, &samsung_abox_dump_driver,

View file

@ -196,8 +196,10 @@ int abox_core_standby(void)
"standby timeout(%d)", "standby timeout(%d)",
core->id); core->id);
abox_err(dev, "%s\n", reason); abox_err(dev, "%s\n", reason);
#ifdef CONFIG_SND_SOC_SAMSUNG_DEBUG
abox_dbg_dump_gpr_mem(dev, data, abox_dbg_dump_gpr_mem(dev, data,
ABOX_DBG_DUMP_KERNEL, reason); ABOX_DBG_DUMP_KERNEL, reason);
#endif
kfree(reason); kfree(reason);
ret = -EBUSY; ret = -EBUSY;
@ -559,7 +561,9 @@ int abox_core_download_firmware(void)
if (fw->code_signed && fw->fw_imgloader_desc) { if (fw->code_signed && fw->fw_imgloader_desc) {
ret |= imgloader_boot(fw->fw_imgloader_desc); ret |= imgloader_boot(fw->fw_imgloader_desc);
if (ret < 0) { if (ret < 0) {
#ifdef CONFIG_SND_SOC_SAMSUNG_DEBUG
abox_dbg_dump_mem(dev, data, ABOX_DBG_DUMP_KERNEL, "verification fail"); abox_dbg_dump_mem(dev, data, ABOX_DBG_DUMP_KERNEL, "verification fail");
#endif
abox_failsafe_report(dev, true); abox_failsafe_report(dev, true);
} }
continue; continue;

View file

@ -1407,7 +1407,9 @@ static void abox_rdma_disable_barrier(struct device *dev,
continue; continue;
} }
dev_warn_ratelimited(dev, "RDMA disable timeout\n"); dev_warn_ratelimited(dev, "RDMA disable timeout\n");
#ifdef CONFIG_SND_SOC_SAMSUNG_DEBUG
abox_dbg_dump_simple(dev, abox_data, "RDMA disable timeout"); abox_dbg_dump_simple(dev, abox_data, "RDMA disable timeout");
#endif
/* Disable DMA by force */ /* Disable DMA by force */
regmap_update_bits_base(abox_data->regmap, regmap_update_bits_base(abox_data->regmap,
ABOX_RDMA_CTRL(data->id), ABOX_RDMA_CTRL(data->id),

View file

@ -147,7 +147,9 @@ static void abox_wdma_disable_barrier(struct device *dev,
continue; continue;
} }
dev_warn_ratelimited(dev, "WDMA disable timeout\n"); dev_warn_ratelimited(dev, "WDMA disable timeout\n");
#ifdef CONFIG_SND_SOC_SAMSUNG_DEBUG
abox_dbg_dump_simple(dev, abox_data, "WDMA disable timeout"); abox_dbg_dump_simple(dev, abox_data, "WDMA disable timeout");
#endif
/* Disable DMA by force */ /* Disable DMA by force */
regmap_update_bits_base(abox_data->regmap, regmap_update_bits_base(abox_data->regmap,
ABOX_WDMA_CTRL(data->id), ABOX_WDMA_CTRL(data->id),