mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/3] soundwire: enable Data Port test modes
@ 2020-09-20 19:32 Bard Liao
  2020-09-20 19:32 ` [PATCH 2/3] soundwire: intel: enable " Bard Liao
  2020-09-23  9:59 ` [PATCH 0/3] soundwire: enable Data Port " Vinod Koul
  0 siblings, 2 replies; 3+ messages in thread
From: Bard Liao @ 2020-09-20 19:32 UTC (permalink / raw)
  To: alsa-devel, vkoul
  Cc: vinod.koul, linux-kernel, gregkh, jank, srinivas.kandagatla,
	rander.wang, ranjani.sridharan, hui.wang, pierre-louis.bossart,
	sanyog.r.kale, mengdong.lin, bard.liao

Test modes are required for all SoundWire IP, and help debug
integration issues. This series adds debugfs support and data
port test fail interrupt to enable data port test mode feature
on Intel platforms. 

Pierre-Louis Bossart (3):
  soundwire: enable Data Port test modes
  soundwire: intel: enable test modes
  soundwire: cadence: add data port test fail interrupt

 drivers/soundwire/bus.c                       |  6 +++
 drivers/soundwire/cadence_master.c            | 27 ++++++++++--
 .../soundwire/generic_bandwidth_allocation.c  |  6 ++-
 drivers/soundwire/intel.c                     | 42 +++++++++++++++++++
 drivers/soundwire/stream.c                    |  3 +-
 include/linux/soundwire/sdw.h                 |  6 +++
 6 files changed, 84 insertions(+), 6 deletions(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 2/3] soundwire: intel: enable test modes
  2020-09-20 19:32 [PATCH 0/3] soundwire: enable Data Port test modes Bard Liao
@ 2020-09-20 19:32 ` Bard Liao
  2020-09-23  9:59 ` [PATCH 0/3] soundwire: enable Data Port " Vinod Koul
  1 sibling, 0 replies; 3+ messages in thread
From: Bard Liao @ 2020-09-20 19:32 UTC (permalink / raw)
  To: alsa-devel, vkoul
  Cc: vinod.koul, linux-kernel, gregkh, jank, srinivas.kandagatla,
	rander.wang, ranjani.sridharan, hui.wang, pierre-louis.bossart,
	sanyog.r.kale, mengdong.lin, bard.liao

From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

This patch adds debugfs support to override the Master and Slave data
modes. The settings only take effect prior to a new stream being
prepared/enabled, or on resume.

The test mode can be set to verify data integrity and detect bus
clashes, but can only be used to test capture paths. In this case the
input generated by a Slave source port is replaced by a fixed or
cyclical patterns.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
---
 drivers/soundwire/intel.c | 42 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/drivers/soundwire/intel.c b/drivers/soundwire/intel.c
index 7dc6569ac431..6a1e862b16c3 100644
--- a/drivers/soundwire/intel.c
+++ b/drivers/soundwire/intel.c
@@ -262,6 +262,42 @@ static int intel_reg_show(struct seq_file *s_file, void *data)
 }
 DEFINE_SHOW_ATTRIBUTE(intel_reg);
 
+static int intel_set_m_datamode(void *data, u64 value)
+{
+	struct sdw_intel *sdw = data;
+	struct sdw_bus *bus = &sdw->cdns.bus;
+
+	if (value > SDW_PORT_DATA_MODE_STATIC_1)
+		return -EINVAL;
+
+	/* Userspace changed the hardware state behind the kernel's back */
+	add_taint(TAINT_USER, LOCKDEP_STILL_OK);
+
+	bus->params.m_data_mode = value;
+
+	return 0;
+}
+DEFINE_DEBUGFS_ATTRIBUTE(intel_set_m_datamode_fops, NULL,
+			 intel_set_m_datamode, "%llu\n");
+
+static int intel_set_s_datamode(void *data, u64 value)
+{
+	struct sdw_intel *sdw = data;
+	struct sdw_bus *bus = &sdw->cdns.bus;
+
+	if (value > SDW_PORT_DATA_MODE_STATIC_1)
+		return -EINVAL;
+
+	/* Userspace changed the hardware state behind the kernel's back */
+	add_taint(TAINT_USER, LOCKDEP_STILL_OK);
+
+	bus->params.s_data_mode = value;
+
+	return 0;
+}
+DEFINE_DEBUGFS_ATTRIBUTE(intel_set_s_datamode_fops, NULL,
+			 intel_set_s_datamode, "%llu\n");
+
 static void intel_debugfs_init(struct sdw_intel *sdw)
 {
 	struct dentry *root = sdw->cdns.bus.debugfs;
@@ -274,6 +310,12 @@ static void intel_debugfs_init(struct sdw_intel *sdw)
 	debugfs_create_file("intel-registers", 0400, sdw->debugfs, sdw,
 			    &intel_reg_fops);
 
+	debugfs_create_file("intel-m-datamode", 0200, sdw->debugfs, sdw,
+			    &intel_set_m_datamode_fops);
+
+	debugfs_create_file("intel-s-datamode", 0200, sdw->debugfs, sdw,
+			    &intel_set_s_datamode_fops);
+
 	sdw_cdns_debugfs_init(&sdw->cdns, sdw->debugfs);
 }
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 0/3] soundwire: enable Data Port test modes
  2020-09-20 19:32 [PATCH 0/3] soundwire: enable Data Port test modes Bard Liao
  2020-09-20 19:32 ` [PATCH 2/3] soundwire: intel: enable " Bard Liao
@ 2020-09-23  9:59 ` Vinod Koul
  1 sibling, 0 replies; 3+ messages in thread
From: Vinod Koul @ 2020-09-23  9:59 UTC (permalink / raw)
  To: Bard Liao
  Cc: alsa-devel, linux-kernel, gregkh, jank, srinivas.kandagatla,
	rander.wang, ranjani.sridharan, hui.wang, pierre-louis.bossart,
	sanyog.r.kale, mengdong.lin, bard.liao

On 21-09-20, 03:32, Bard Liao wrote:
> Test modes are required for all SoundWire IP, and help debug
> integration issues. This series adds debugfs support and data
> port test fail interrupt to enable data port test mode feature
> on Intel platforms. 

Applied, thanks

-- 
~Vinod

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-09-23  9:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-20 19:32 [PATCH 0/3] soundwire: enable Data Port test modes Bard Liao
2020-09-20 19:32 ` [PATCH 2/3] soundwire: intel: enable " Bard Liao
2020-09-23  9:59 ` [PATCH 0/3] soundwire: enable Data Port " Vinod Koul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®