Commit abd9a604 authored by Srinivas Kandagatla's avatar Srinivas Kandagatla Committed by Vinod Koul

soundwire: qcom: add debugfs entry for soundwire register dump

For debug purposes add an entry in debugfs to dump Qualcomm
SoundWire Controller registers.
Signed-off-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20210907105636.3171-1-srinivas.kandagatla@linaro.orgSigned-off-by: default avatarVinod Koul <vkoul@kernel.org>
parent 4cbbe74d
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <linux/io.h> #include <linux/io.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/debugfs.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_irq.h> #include <linux/of_irq.h>
#include <linux/of_device.h> #include <linux/of_device.h>
...@@ -83,6 +84,7 @@ ...@@ -83,6 +84,7 @@
#define SWRM_DP_PORT_HCTRL_BANK(n, m) (0x1134 + 0x100 * (n - 1) + 0x40 * m) #define SWRM_DP_PORT_HCTRL_BANK(n, m) (0x1134 + 0x100 * (n - 1) + 0x40 * m)
#define SWRM_DP_BLOCK_CTRL3_BANK(n, m) (0x1138 + 0x100 * (n - 1) + 0x40 * m) #define SWRM_DP_BLOCK_CTRL3_BANK(n, m) (0x1138 + 0x100 * (n - 1) + 0x40 * m)
#define SWRM_DIN_DPn_PCM_PORT_CTRL(n) (0x1054 + 0x100 * (n - 1)) #define SWRM_DIN_DPn_PCM_PORT_CTRL(n) (0x1054 + 0x100 * (n - 1))
#define SWR_MSTR_MAX_REG_ADDR (0x1740)
#define SWRM_DP_PORT_CTRL_EN_CHAN_SHFT 0x18 #define SWRM_DP_PORT_CTRL_EN_CHAN_SHFT 0x18
#define SWRM_DP_PORT_CTRL_OFFSET2_SHFT 0x10 #define SWRM_DP_PORT_CTRL_OFFSET2_SHFT 0x10
...@@ -127,6 +129,9 @@ struct qcom_swrm_ctrl { ...@@ -127,6 +129,9 @@ struct qcom_swrm_ctrl {
struct device *dev; struct device *dev;
struct regmap *regmap; struct regmap *regmap;
void __iomem *mmio; void __iomem *mmio;
#ifdef CONFIG_DEBUG_FS
struct dentry *debugfs;
#endif
struct completion broadcast; struct completion broadcast;
struct completion enumeration; struct completion enumeration;
struct work_struct slave_work; struct work_struct slave_work;
...@@ -1192,6 +1197,22 @@ static int qcom_swrm_get_port_config(struct qcom_swrm_ctrl *ctrl) ...@@ -1192,6 +1197,22 @@ static int qcom_swrm_get_port_config(struct qcom_swrm_ctrl *ctrl)
return 0; return 0;
} }
#ifdef CONFIG_DEBUG_FS
static int swrm_reg_show(struct seq_file *s_file, void *data)
{
struct qcom_swrm_ctrl *swrm = s_file->private;
int reg, reg_val;
for (reg = 0; reg <= SWR_MSTR_MAX_REG_ADDR; reg += 4) {
swrm->reg_read(swrm, reg, &reg_val);
seq_printf(s_file, "0x%.3x: 0x%.2x\n", reg, reg_val);
}
return 0;
}
DEFINE_SHOW_ATTRIBUTE(swrm_reg);
#endif
static int qcom_swrm_probe(struct platform_device *pdev) static int qcom_swrm_probe(struct platform_device *pdev)
{ {
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
...@@ -1302,6 +1323,12 @@ static int qcom_swrm_probe(struct platform_device *pdev) ...@@ -1302,6 +1323,12 @@ static int qcom_swrm_probe(struct platform_device *pdev)
(ctrl->version >> 24) & 0xff, (ctrl->version >> 16) & 0xff, (ctrl->version >> 24) & 0xff, (ctrl->version >> 16) & 0xff,
ctrl->version & 0xffff); ctrl->version & 0xffff);
#ifdef CONFIG_DEBUG_FS
ctrl->debugfs = debugfs_create_dir("qualcomm-sdw", ctrl->bus.debugfs);
debugfs_create_file("qualcomm-registers", 0400, ctrl->debugfs, ctrl,
&swrm_reg_fops);
#endif
return 0; return 0;
err_master_add: err_master_add:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment