From 175bec148a04747234fce8897c16014ab40c9fb6 Mon Sep 17 00:00:00 2001 From: Tao Zhang Date: Tue, 14 Jun 2022 19:46:45 +0800 Subject: [PATCH 1/2] soc: qcom: smp2p: Add remote_id into smp2p irq devname Changed smp2p irq devname from "smp2p" to "smp2p_", which makes the wakeup source distinguishable in irq wakeup prints. Change-Id: Id18819be3867df5070ad198c75980ea8f502dbe1 Signed-off-by: Tao Zhang --- drivers/soc/qcom/smp2p.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/soc/qcom/smp2p.c b/drivers/soc/qcom/smp2p.c index 23d6cbfded0d..c11387ba55b9 100644 --- a/drivers/soc/qcom/smp2p.c +++ b/drivers/soc/qcom/smp2p.c @@ -123,6 +123,7 @@ struct smp2p_entry { * @out: pointer to the outbound smem item * @smem_items: ids of the two smem items * @valid_entries: already scanned inbound entries + * @irq_devname: poniter to the smp2p irq devname * @local_pid: processor id of the inbound edge * @remote_pid: processor id of the outbound edge * @ipc_regmap: regmap for the outbound ipc @@ -147,6 +148,7 @@ struct qcom_smp2p { bool ssr_ack; bool negotiation_done; + char *irq_devname; unsigned local_pid; unsigned remote_pid; @@ -657,10 +659,15 @@ static int qcom_smp2p_probe(struct platform_device *pdev) qcom_smp2p_kick(smp2p); smp2p->irq = irq; + smp2p->irq_devname = kasprintf(GFP_KERNEL, "smp2p_%d", smp2p->remote_pid); + if (!smp2p->irq_devname) { + ret = -ENOMEM; + goto unwind_interfaces; + } ret = devm_request_threaded_irq(&pdev->dev, irq, NULL, qcom_smp2p_intr, IRQF_ONESHOT, - "smp2p", (void *)smp2p); + smp2p->irq_devname, (void *)smp2p); if (ret) { dev_err(&pdev->dev, "failed to request interrupt\n"); goto unwind_interfaces; @@ -693,6 +700,8 @@ static int qcom_smp2p_probe(struct platform_device *pdev) list_for_each_entry(entry, &smp2p->outbound, node) qcom_smem_state_unregister(entry->state); + kfree(smp2p->irq_devname); + smp2p->out->valid_entries = 0; release_mbox: @@ -720,6 +729,8 @@ static int qcom_smp2p_remove(struct platform_device *pdev) mbox_free_channel(smp2p->mbox_chan); + kfree(smp2p->irq_devname); + smp2p->out->valid_entries = 0; return 0; From f513b883daba70b0c5753735adc6eaffb66997c1 Mon Sep 17 00:00:00 2001 From: Deepak Kumar Singh Date: Mon, 16 Aug 2021 17:09:14 +0530 Subject: [PATCH 2/2] soc: qcom: aoss: Add debugfs entry It can be useful to control the different power states of various parts of hardware for device testing. Add a debugfs node for qmp so messages can be sent to aoss for debugging and testing purposes. Change-Id: I8a147461c550e3b3a54ce168ffaf42a086a5c420 Signed-off-by: Chris Lew Signed-off-by: Deepak Kumar Singh --- drivers/soc/qcom/qcom_aoss.c | 39 ++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/drivers/soc/qcom/qcom_aoss.c b/drivers/soc/qcom/qcom_aoss.c index a59bb34e5eba..7e67a2c5b5c9 100644 --- a/drivers/soc/qcom/qcom_aoss.c +++ b/drivers/soc/qcom/qcom_aoss.c @@ -3,6 +3,7 @@ * Copyright (c) 2019, Linaro Ltd */ #include +#include #include #include #include @@ -82,6 +83,9 @@ struct qmp { struct clk_hw qdss_clk; struct qmp_cooling_device *cooling_devs; +#if IS_ENABLED(CONFIG_DEBUG_FS) + struct dentry *debugfs_file; +#endif /* CONFIG_DEBUG_FS */ }; static void qmp_kick(struct qmp *qmp) @@ -474,6 +478,32 @@ void qmp_put(struct qmp *qmp) } EXPORT_SYMBOL(qmp_put); +#if IS_ENABLED(CONFIG_DEBUG_FS) +static ssize_t aoss_dbg_write(struct file *file, const char __user *userstr, + size_t len, loff_t *pos) +{ + struct qmp *qmp = file->private_data; + char buf[QMP_MSG_LEN] = {}; + int ret; + + if (!len || len >= QMP_MSG_LEN) + return -EINVAL; + + ret = copy_from_user(buf, userstr, len); + if (ret) + return -EFAULT; + + ret = qmp_send(qmp, strim(buf), QMP_MSG_LEN); + + return ret ? ret : len; +} + +static const struct file_operations aoss_dbg_fops = { + .open = simple_open, + .write = aoss_dbg_write, +}; +#endif /* CONFIG_DEBUG_FS */ + static int qmp_probe(struct platform_device *pdev) { struct qmp *qmp; @@ -522,6 +552,11 @@ static int qmp_probe(struct platform_device *pdev) platform_set_drvdata(pdev, qmp); +#if IS_ENABLED(CONFIG_DEBUG_FS) + qmp->debugfs_file = debugfs_create_file("aoss_send_message", 0220, NULL, + qmp, &aoss_dbg_fops); +#endif /* CONFIG_DEBUG_FS */ + return 0; err_close_qmp: @@ -536,6 +571,10 @@ static int qmp_remove(struct platform_device *pdev) { struct qmp *qmp = platform_get_drvdata(pdev); +#if IS_ENABLED(CONFIG_DEBUG_FS) + debugfs_remove(qmp->debugfs_file); +#endif /* CONFIG_DEBUG_FS */ + qmp_qdss_clk_remove(qmp); qmp_cooling_devices_remove(qmp);