122 lines
3.2 KiB
Diff
122 lines
3.2 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Vinod Koul <vinod.koul@intel.com>
|
|
Date: Mon, 31 Aug 2015 14:05:10 +0530
|
|
Subject: [PATCH] ASoC: Intel: Skylake: Add NHLT override control
|
|
|
|
For debugging purposes we may want to not use the BIOS values and
|
|
test our own values, so allow the override by adding a control
|
|
file for override method
|
|
|
|
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
|
|
Signed-off-by: Guneshwor Singh <guneshwor.o.singh@intel.com>
|
|
---
|
|
sound/soc/intel/skylake/skl-debug.c | 65 +++++++++++++++++++++++++++++
|
|
sound/soc/intel/skylake/skl.h | 1 +
|
|
2 files changed, 66 insertions(+)
|
|
|
|
diff --git a/sound/soc/intel/skylake/skl-debug.c b/sound/soc/intel/skylake/skl-debug.c
|
|
index 5d7ac2e..09321ba 100644
|
|
--- a/sound/soc/intel/skylake/skl-debug.c
|
|
+++ b/sound/soc/intel/skylake/skl-debug.c
|
|
@@ -33,6 +33,7 @@ struct skl_debug {
|
|
|
|
struct dentry *fs;
|
|
struct dentry *modules;
|
|
+ struct dentry *nhlt;
|
|
u8 fw_read_buff[FW_REG_BUF];
|
|
};
|
|
|
|
@@ -221,6 +222,61 @@ static const struct file_operations soft_regs_ctrl_fops = {
|
|
.llseek = default_llseek,
|
|
};
|
|
|
|
+static ssize_t nhlt_control_read(struct file *file,
|
|
+ char __user *user_buf, size_t count, loff_t *ppos)
|
|
+{
|
|
+ struct skl_debug *d = file->private_data;
|
|
+ char *state;
|
|
+
|
|
+ state = d->skl->nhlt_override ? "enable\n" : "disable\n";
|
|
+ return simple_read_from_buffer(user_buf, count, ppos,
|
|
+ state, strlen(state));
|
|
+}
|
|
+
|
|
+static ssize_t nhlt_control_write(struct file *file,
|
|
+ const char __user *user_buf, size_t count, loff_t *ppos)
|
|
+{
|
|
+ struct skl_debug *d = file->private_data;
|
|
+ char buf[16];
|
|
+ int len = min(count, (sizeof(buf) - 1));
|
|
+
|
|
+
|
|
+ if (copy_from_user(buf, user_buf, len))
|
|
+ return -EFAULT;
|
|
+ buf[len] = 0;
|
|
+
|
|
+ if (!strncmp(buf, "enable\n", len))
|
|
+ d->skl->nhlt_override = true;
|
|
+ else if (!strncmp(buf, "disable\n", len))
|
|
+ d->skl->nhlt_override = false;
|
|
+ else
|
|
+ return -EINVAL;
|
|
+
|
|
+ /* Userspace has been fiddling around behind the kernel's back */
|
|
+ add_taint(TAINT_USER, LOCKDEP_NOW_UNRELIABLE);
|
|
+
|
|
+ return len;
|
|
+}
|
|
+
|
|
+static const struct file_operations ssp_cntrl_nhlt_fops = {
|
|
+ .open = simple_open,
|
|
+ .read = nhlt_control_read,
|
|
+ .write = nhlt_control_write,
|
|
+ .llseek = default_llseek,
|
|
+};
|
|
+
|
|
+static int skl_init_nhlt(struct skl_debug *d)
|
|
+{
|
|
+ if (!debugfs_create_file("control",
|
|
+ 0644, d->nhlt,
|
|
+ d, &ssp_cntrl_nhlt_fops)) {
|
|
+ dev_err(d->dev, "nhlt control debugfs init failed\n");
|
|
+ return -EIO;
|
|
+ }
|
|
+
|
|
+ return 0;
|
|
+}
|
|
+
|
|
struct skl_debug *skl_debugfs_init(struct skl *skl)
|
|
{
|
|
struct skl_debug *d;
|
|
@@ -253,6 +309,15 @@ struct skl_debug *skl_debugfs_init(struct skl *skl)
|
|
goto err;
|
|
}
|
|
|
|
+ /* now create the NHLT dir */
|
|
+ d->nhlt = debugfs_create_dir("nhlt", d->fs);
|
|
+ if (IS_ERR(d->nhlt) || !d->nhlt) {
|
|
+ dev_err(&skl->pci->dev, "nhlt debugfs create failed\n");
|
|
+ return NULL;
|
|
+ }
|
|
+
|
|
+ skl_init_nhlt(d);
|
|
+
|
|
return d;
|
|
|
|
err:
|
|
diff --git a/sound/soc/intel/skylake/skl.h b/sound/soc/intel/skylake/skl.h
|
|
index 78aa8bd..28c62dd 100644
|
|
--- a/sound/soc/intel/skylake/skl.h
|
|
+++ b/sound/soc/intel/skylake/skl.h
|
|
@@ -103,6 +103,7 @@ struct skl {
|
|
bool use_tplg_pcm;
|
|
struct skl_fw_config cfg;
|
|
struct snd_soc_acpi_mach *mach;
|
|
+ bool nhlt_override;
|
|
};
|
|
|
|
#define skl_to_bus(s) (&(s)->hbus)
|
|
--
|
|
2.21.0
|
|
|