soundwire: enable Data Port test modes
authorPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Sun, 20 Sep 2020 19:32:05 +0000 (03:32 +0800)
committerVinod Koul <vkoul@kernel.org>
Wed, 23 Sep 2020 09:59:29 +0000 (15:29 +0530)
Test modes are required for all SoundWire IP, and help debug
integration issues. In theory each port can be configured with a
different mode but to simplify this patch only offers separate
configurations for the Master and Slave ports - this covers 99% of the
intended cases during platform integration.

The test mode value is set via platform-specific ways.

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>
Link: https://lore.kernel.org/r/20200920193207.31241-2-yung-chuan.liao@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/soundwire/bus.c
drivers/soundwire/generic_bandwidth_allocation.c
drivers/soundwire/stream.c
include/linux/soundwire/sdw.h

index 340fd1e..e3fe53f 100644 (file)
@@ -1099,6 +1099,12 @@ int sdw_configure_dpn_intr(struct sdw_slave *slave,
        int ret;
        u8 val = 0;
 
+       if (slave->bus->params.s_data_mode != SDW_PORT_DATA_MODE_NORMAL) {
+               dev_dbg(&slave->dev, "TEST FAIL interrupt %s\n",
+                       enable ? "on" : "off");
+               mask |= SDW_DPN_INT_TEST_FAIL;
+       }
+
        addr = SDW_DPN_INTMASK(port);
 
        /* Set/Clear port ready interrupt mask */
index 6088775..058cb9c 100644 (file)
@@ -43,6 +43,7 @@ static void sdw_compute_slave_ports(struct sdw_master_runtime *m_rt,
        int port_bo, sample_int;
        unsigned int rate, bps, ch = 0;
        unsigned int slave_total_ch;
+       struct sdw_bus_params *b_params = &m_rt->bus->params;
 
        port_bo = t_data->block_offset;
 
@@ -66,7 +67,7 @@ static void sdw_compute_slave_ports(struct sdw_master_runtime *m_rt,
                        sdw_fill_port_params(&p_rt->port_params,
                                             p_rt->num, bps,
                                             SDW_PORT_FLOW_MODE_ISOCH,
-                                            SDW_PORT_DATA_MODE_NORMAL);
+                                            b_params->s_data_mode);
 
                        port_bo += bps * ch;
                        slave_total_ch += ch;
@@ -92,6 +93,7 @@ static void sdw_compute_master_ports(struct sdw_master_runtime *m_rt,
        struct sdw_transport_data t_data = {0};
        struct sdw_port_runtime *p_rt;
        struct sdw_bus *bus = m_rt->bus;
+       struct sdw_bus_params *b_params = &bus->params;
        int sample_int, hstart = 0;
        unsigned int rate, bps, ch, no_ch;
 
@@ -118,7 +120,7 @@ static void sdw_compute_master_ports(struct sdw_master_runtime *m_rt,
                sdw_fill_port_params(&p_rt->port_params,
                                     p_rt->num, bps,
                                     SDW_PORT_FLOW_MODE_ISOCH,
-                                    SDW_PORT_DATA_MODE_NORMAL);
+                                    b_params->m_data_mode);
 
                /* Check for first entry */
                if (!(p_rt == list_first_entry(&m_rt->port_list,
index f3219d1..8608b09 100644 (file)
@@ -443,7 +443,8 @@ static int sdw_prep_deprep_slave_ports(struct sdw_bus *bus,
 
        prep_ch.bank = bus->params.next_bank;
 
-       if (dpn_prop->imp_def_interrupts || !dpn_prop->simple_ch_prep_sm)
+       if (dpn_prop->imp_def_interrupts || !dpn_prop->simple_ch_prep_sm ||
+           bus->params.s_data_mode != SDW_PORT_DATA_MODE_NORMAL)
                intr = true;
 
        /*
index de9ea2c..41cc119 100644 (file)
@@ -554,6 +554,10 @@ enum sdw_port_prep_ops {
  * @bandwidth: Current bandwidth
  * @col: Active columns
  * @row: Active rows
+ * @s_data_mode: NORMAL, STATIC or PRBS mode for all Slave ports
+ * @m_data_mode: NORMAL, STATIC or PRBS mode for all Master ports. The value
+ * should be the same to detect transmission issues, but can be different to
+ * test the interrupt reports
  */
 struct sdw_bus_params {
        enum sdw_reg_bank curr_bank;
@@ -563,6 +567,8 @@ struct sdw_bus_params {
        unsigned int bandwidth;
        unsigned int col;
        unsigned int row;
+       int s_data_mode;
+       int m_data_mode;
 };
 
 /**