Merge "soc: qcom: aoss: Add debugfs entry"

This commit is contained in:
qctecmdr 2022-06-29 14:55:02 -07:00 committed by Gerrit - the friendly Code Review server
commit 1b9186ec6a
2 changed files with 51 additions and 1 deletions

View File

@ -3,6 +3,7 @@
* Copyright (c) 2019, Linaro Ltd
*/
#include <linux/clk-provider.h>
#include <linux/debugfs.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/mailbox_client.h>
@ -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);

View File

@ -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;
@ -658,10 +660,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;
@ -694,6 +701,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:
@ -721,6 +730,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;