Commit 2acd30b9f6032c6cbefc5e255c17ebbb0718e56a

Authored by Pierre-Louis Bossart
Committed by Vinod Koul
1 parent 09309093d5

ASoC/soundwire: bus: use property to set interrupt masks

Add a slave-level property and program the SCP_INT1_MASK as desired by
the codec driver. Since there is no DisCo property this has to be an
implementation-specific firmware property or hard-coded in the driver.

The only functionality change is that implementation-defined
interrupts are no longer set for amplifiers - those interrupts are
typically for jack detection or acoustic event detection/hotwording.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Tested-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20200908134521.6781-2-yung-chuan.liao@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>

Showing 9 changed files with 30 additions and 6 deletions Side-by-side Diff

drivers/soundwire/bus.c
... ... @@ -1184,13 +1184,13 @@
1184 1184 return ret;
1185 1185  
1186 1186 /*
1187   - * Set bus clash, parity and SCP implementation
1188   - * defined interrupt mask
1189   - * TODO: Read implementation defined interrupt mask
1190   - * from Slave property
  1187 + * Set SCP_INT1_MASK register, typically bus clash and
  1188 + * implementation-defined interrupt mask. The Parity detection
  1189 + * may not always be correct on startup so its use is
  1190 + * device-dependent, it might e.g. only be enabled in
  1191 + * steady-state after a couple of frames.
1191 1192 */
1192   - val = SDW_SCP_INT1_IMPL_DEF | SDW_SCP_INT1_BUS_CLASH |
1193   - SDW_SCP_INT1_PARITY;
  1193 + val = slave->prop.scp_int1_mask;
1194 1194  
1195 1195 /* Enable SCP interrupts */
1196 1196 ret = sdw_update(slave, SDW_SCP_INTMASK1, val, val);
include/linux/soundwire/sdw.h
... ... @@ -357,6 +357,7 @@
357 357 * @dp0_prop: Data Port 0 properties
358 358 * @src_dpn_prop: Source Data Port N properties
359 359 * @sink_dpn_prop: Sink Data Port N properties
  360 + * @scp_int1_mask: SCP_INT1_MASK desired settings
360 361 */
361 362 struct sdw_slave_prop {
362 363 u32 mipi_revision;
... ... @@ -378,6 +379,7 @@
378 379 struct sdw_dp0_prop *dp0_prop;
379 380 struct sdw_dpn_prop *src_dpn_prop;
380 381 struct sdw_dpn_prop *sink_dpn_prop;
  382 + u8 scp_int1_mask;
381 383 };
382 384  
383 385 /**
sound/soc/codecs/max98373-sdw.c
... ... @@ -15,6 +15,7 @@
15 15 #include <linux/of.h>
16 16 #include <linux/soundwire/sdw.h>
17 17 #include <linux/soundwire/sdw_type.h>
  18 +#include <linux/soundwire/sdw_registers.h>
18 19 #include "max98373.h"
19 20 #include "max98373-sdw.h"
20 21  
... ... @@ -286,6 +287,8 @@
286 287 u32 bit;
287 288 unsigned long addr;
288 289 struct sdw_dpn_prop *dpn;
  290 +
  291 + prop->scp_int1_mask = SDW_SCP_INT1_BUS_CLASH | SDW_SCP_INT1_PARITY;
289 292  
290 293 /* BITMAP: 00001000 Dataport 3 is active */
291 294 prop->source_ports = BIT(3);
sound/soc/codecs/rt1308-sdw.c
... ... @@ -123,6 +123,8 @@
123 123 unsigned long addr;
124 124 struct sdw_dpn_prop *dpn;
125 125  
  126 + prop->scp_int1_mask = SDW_SCP_INT1_BUS_CLASH | SDW_SCP_INT1_PARITY;
  127 +
126 128 prop->paging_support = true;
127 129  
128 130 /* first we need to allocate memory for set bits in port lists */
sound/soc/codecs/rt5682-sdw.c
... ... @@ -19,6 +19,7 @@
19 19 #include <linux/mutex.h>
20 20 #include <linux/soundwire/sdw.h>
21 21 #include <linux/soundwire/sdw_type.h>
  22 +#include <linux/soundwire/sdw_registers.h>
22 23 #include <sound/core.h>
23 24 #include <sound/pcm.h>
24 25 #include <sound/pcm_params.h>
... ... @@ -541,6 +542,9 @@
541 542 u32 bit;
542 543 unsigned long addr;
543 544 struct sdw_dpn_prop *dpn;
  545 +
  546 + prop->scp_int1_mask = SDW_SCP_INT1_IMPL_DEF | SDW_SCP_INT1_BUS_CLASH |
  547 + SDW_SCP_INT1_PARITY;
544 548  
545 549 prop->paging_support = false;
546 550  
sound/soc/codecs/rt700-sdw.c
... ... @@ -11,6 +11,7 @@
11 11 #include <linux/mod_devicetable.h>
12 12 #include <linux/soundwire/sdw.h>
13 13 #include <linux/soundwire/sdw_type.h>
  14 +#include <linux/soundwire/sdw_registers.h>
14 15 #include <linux/module.h>
15 16 #include <linux/regmap.h>
16 17 #include <sound/soc.h>
... ... @@ -337,6 +338,9 @@
337 338 u32 bit;
338 339 unsigned long addr;
339 340 struct sdw_dpn_prop *dpn;
  341 +
  342 + prop->scp_int1_mask = SDW_SCP_INT1_IMPL_DEF | SDW_SCP_INT1_BUS_CLASH |
  343 + SDW_SCP_INT1_PARITY;
340 344  
341 345 prop->paging_support = false;
342 346  
sound/soc/codecs/rt711-sdw.c
... ... @@ -11,6 +11,7 @@
11 11 #include <linux/mod_devicetable.h>
12 12 #include <linux/soundwire/sdw.h>
13 13 #include <linux/soundwire/sdw_type.h>
  14 +#include <linux/soundwire/sdw_registers.h>
14 15 #include <linux/module.h>
15 16 #include <linux/regmap.h>
16 17 #include <sound/soc.h>
... ... @@ -341,6 +342,9 @@
341 342 u32 bit;
342 343 unsigned long addr;
343 344 struct sdw_dpn_prop *dpn;
  345 +
  346 + prop->scp_int1_mask = SDW_SCP_INT1_IMPL_DEF | SDW_SCP_INT1_BUS_CLASH |
  347 + SDW_SCP_INT1_PARITY;
344 348  
345 349 prop->paging_support = false;
346 350  
sound/soc/codecs/rt715-sdw.c
... ... @@ -12,6 +12,7 @@
12 12 #include <linux/mod_devicetable.h>
13 13 #include <linux/soundwire/sdw.h>
14 14 #include <linux/soundwire/sdw_type.h>
  15 +#include <linux/soundwire/sdw_registers.h>
15 16 #include <linux/module.h>
16 17 #include <linux/of.h>
17 18 #include <linux/regmap.h>
... ... @@ -435,6 +436,9 @@
435 436 u32 bit;
436 437 unsigned long addr;
437 438 struct sdw_dpn_prop *dpn;
  439 +
  440 + prop->scp_int1_mask = SDW_SCP_INT1_IMPL_DEF | SDW_SCP_INT1_BUS_CLASH |
  441 + SDW_SCP_INT1_PARITY;
438 442  
439 443 prop->paging_support = false;
440 444  
sound/soc/codecs/wsa881x.c
... ... @@ -1112,6 +1112,7 @@
1112 1112 wsa881x->sconfig.type = SDW_STREAM_PDM;
1113 1113 pdev->prop.sink_ports = GENMASK(WSA881X_MAX_SWR_PORTS, 0);
1114 1114 pdev->prop.sink_dpn_prop = wsa_sink_dpn_prop;
  1115 + pdev->prop.scp_int1_mask = SDW_SCP_INT1_BUS_CLASH | SDW_SCP_INT1_PARITY;
1115 1116 gpiod_direction_output(wsa881x->sd_n, 1);
1116 1117  
1117 1118 wsa881x->regmap = devm_regmap_init_sdw(pdev, &wsa881x_regmap_config);