Commit 2acd30b9 authored by Pierre-Louis Bossart's avatar Pierre-Louis Bossart Committed by Vinod Koul

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: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: default avatarBard Liao <yung-chuan.liao@linux.intel.com>
Tested-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Reviewed-by: default avatarKai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: default avatarGuennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Acked-by: default avatarMark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20200908134521.6781-2-yung-chuan.liao@linux.intel.comSigned-off-by: default avatarVinod Koul <vkoul@kernel.org>
parent 09309093
...@@ -1184,13 +1184,13 @@ static int sdw_initialize_slave(struct sdw_slave *slave) ...@@ -1184,13 +1184,13 @@ static int sdw_initialize_slave(struct sdw_slave *slave)
return ret; return ret;
/* /*
* Set bus clash, parity and SCP implementation * Set SCP_INT1_MASK register, typically bus clash and
* defined interrupt mask * implementation-defined interrupt mask. The Parity detection
* TODO: Read implementation defined interrupt mask * may not always be correct on startup so its use is
* from Slave property * device-dependent, it might e.g. only be enabled in
* steady-state after a couple of frames.
*/ */
val = SDW_SCP_INT1_IMPL_DEF | SDW_SCP_INT1_BUS_CLASH | val = slave->prop.scp_int1_mask;
SDW_SCP_INT1_PARITY;
/* Enable SCP interrupts */ /* Enable SCP interrupts */
ret = sdw_update(slave, SDW_SCP_INTMASK1, val, val); ret = sdw_update(slave, SDW_SCP_INTMASK1, val, val);
......
...@@ -357,6 +357,7 @@ struct sdw_dpn_prop { ...@@ -357,6 +357,7 @@ struct sdw_dpn_prop {
* @dp0_prop: Data Port 0 properties * @dp0_prop: Data Port 0 properties
* @src_dpn_prop: Source Data Port N properties * @src_dpn_prop: Source Data Port N properties
* @sink_dpn_prop: Sink Data Port N properties * @sink_dpn_prop: Sink Data Port N properties
* @scp_int1_mask: SCP_INT1_MASK desired settings
*/ */
struct sdw_slave_prop { struct sdw_slave_prop {
u32 mipi_revision; u32 mipi_revision;
...@@ -378,6 +379,7 @@ struct sdw_slave_prop { ...@@ -378,6 +379,7 @@ struct sdw_slave_prop {
struct sdw_dp0_prop *dp0_prop; struct sdw_dp0_prop *dp0_prop;
struct sdw_dpn_prop *src_dpn_prop; struct sdw_dpn_prop *src_dpn_prop;
struct sdw_dpn_prop *sink_dpn_prop; struct sdw_dpn_prop *sink_dpn_prop;
u8 scp_int1_mask;
}; };
/** /**
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include <linux/of.h> #include <linux/of.h>
#include <linux/soundwire/sdw.h> #include <linux/soundwire/sdw.h>
#include <linux/soundwire/sdw_type.h> #include <linux/soundwire/sdw_type.h>
#include <linux/soundwire/sdw_registers.h>
#include "max98373.h" #include "max98373.h"
#include "max98373-sdw.h" #include "max98373-sdw.h"
...@@ -287,6 +288,8 @@ static int max98373_read_prop(struct sdw_slave *slave) ...@@ -287,6 +288,8 @@ static int max98373_read_prop(struct sdw_slave *slave)
unsigned long addr; unsigned long addr;
struct sdw_dpn_prop *dpn; struct sdw_dpn_prop *dpn;
prop->scp_int1_mask = SDW_SCP_INT1_BUS_CLASH | SDW_SCP_INT1_PARITY;
/* BITMAP: 00001000 Dataport 3 is active */ /* BITMAP: 00001000 Dataport 3 is active */
prop->source_ports = BIT(3); prop->source_ports = BIT(3);
/* BITMAP: 00000010 Dataport 1 is active */ /* BITMAP: 00000010 Dataport 1 is active */
......
...@@ -123,6 +123,8 @@ static int rt1308_read_prop(struct sdw_slave *slave) ...@@ -123,6 +123,8 @@ static int rt1308_read_prop(struct sdw_slave *slave)
unsigned long addr; unsigned long addr;
struct sdw_dpn_prop *dpn; struct sdw_dpn_prop *dpn;
prop->scp_int1_mask = SDW_SCP_INT1_BUS_CLASH | SDW_SCP_INT1_PARITY;
prop->paging_support = true; prop->paging_support = true;
/* first we need to allocate memory for set bits in port lists */ /* first we need to allocate memory for set bits in port lists */
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/soundwire/sdw.h> #include <linux/soundwire/sdw.h>
#include <linux/soundwire/sdw_type.h> #include <linux/soundwire/sdw_type.h>
#include <linux/soundwire/sdw_registers.h>
#include <sound/core.h> #include <sound/core.h>
#include <sound/pcm.h> #include <sound/pcm.h>
#include <sound/pcm_params.h> #include <sound/pcm_params.h>
...@@ -542,6 +543,9 @@ static int rt5682_read_prop(struct sdw_slave *slave) ...@@ -542,6 +543,9 @@ static int rt5682_read_prop(struct sdw_slave *slave)
unsigned long addr; unsigned long addr;
struct sdw_dpn_prop *dpn; struct sdw_dpn_prop *dpn;
prop->scp_int1_mask = SDW_SCP_INT1_IMPL_DEF | SDW_SCP_INT1_BUS_CLASH |
SDW_SCP_INT1_PARITY;
prop->paging_support = false; prop->paging_support = false;
/* first we need to allocate memory for set bits in port lists */ /* first we need to allocate memory for set bits in port lists */
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include <linux/mod_devicetable.h> #include <linux/mod_devicetable.h>
#include <linux/soundwire/sdw.h> #include <linux/soundwire/sdw.h>
#include <linux/soundwire/sdw_type.h> #include <linux/soundwire/sdw_type.h>
#include <linux/soundwire/sdw_registers.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/regmap.h> #include <linux/regmap.h>
#include <sound/soc.h> #include <sound/soc.h>
...@@ -338,6 +339,9 @@ static int rt700_read_prop(struct sdw_slave *slave) ...@@ -338,6 +339,9 @@ static int rt700_read_prop(struct sdw_slave *slave)
unsigned long addr; unsigned long addr;
struct sdw_dpn_prop *dpn; struct sdw_dpn_prop *dpn;
prop->scp_int1_mask = SDW_SCP_INT1_IMPL_DEF | SDW_SCP_INT1_BUS_CLASH |
SDW_SCP_INT1_PARITY;
prop->paging_support = false; prop->paging_support = false;
/* first we need to allocate memory for set bits in port lists */ /* first we need to allocate memory for set bits in port lists */
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include <linux/mod_devicetable.h> #include <linux/mod_devicetable.h>
#include <linux/soundwire/sdw.h> #include <linux/soundwire/sdw.h>
#include <linux/soundwire/sdw_type.h> #include <linux/soundwire/sdw_type.h>
#include <linux/soundwire/sdw_registers.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/regmap.h> #include <linux/regmap.h>
#include <sound/soc.h> #include <sound/soc.h>
...@@ -342,6 +343,9 @@ static int rt711_read_prop(struct sdw_slave *slave) ...@@ -342,6 +343,9 @@ static int rt711_read_prop(struct sdw_slave *slave)
unsigned long addr; unsigned long addr;
struct sdw_dpn_prop *dpn; struct sdw_dpn_prop *dpn;
prop->scp_int1_mask = SDW_SCP_INT1_IMPL_DEF | SDW_SCP_INT1_BUS_CLASH |
SDW_SCP_INT1_PARITY;
prop->paging_support = false; prop->paging_support = false;
/* first we need to allocate memory for set bits in port lists */ /* first we need to allocate memory for set bits in port lists */
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include <linux/mod_devicetable.h> #include <linux/mod_devicetable.h>
#include <linux/soundwire/sdw.h> #include <linux/soundwire/sdw.h>
#include <linux/soundwire/sdw_type.h> #include <linux/soundwire/sdw_type.h>
#include <linux/soundwire/sdw_registers.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/regmap.h> #include <linux/regmap.h>
...@@ -436,6 +437,9 @@ static int rt715_read_prop(struct sdw_slave *slave) ...@@ -436,6 +437,9 @@ static int rt715_read_prop(struct sdw_slave *slave)
unsigned long addr; unsigned long addr;
struct sdw_dpn_prop *dpn; struct sdw_dpn_prop *dpn;
prop->scp_int1_mask = SDW_SCP_INT1_IMPL_DEF | SDW_SCP_INT1_BUS_CLASH |
SDW_SCP_INT1_PARITY;
prop->paging_support = false; prop->paging_support = false;
/* first we need to allocate memory for set bits in port lists */ /* first we need to allocate memory for set bits in port lists */
......
...@@ -1112,6 +1112,7 @@ static int wsa881x_probe(struct sdw_slave *pdev, ...@@ -1112,6 +1112,7 @@ static int wsa881x_probe(struct sdw_slave *pdev,
wsa881x->sconfig.type = SDW_STREAM_PDM; wsa881x->sconfig.type = SDW_STREAM_PDM;
pdev->prop.sink_ports = GENMASK(WSA881X_MAX_SWR_PORTS, 0); pdev->prop.sink_ports = GENMASK(WSA881X_MAX_SWR_PORTS, 0);
pdev->prop.sink_dpn_prop = wsa_sink_dpn_prop; pdev->prop.sink_dpn_prop = wsa_sink_dpn_prop;
pdev->prop.scp_int1_mask = SDW_SCP_INT1_BUS_CLASH | SDW_SCP_INT1_PARITY;
gpiod_direction_output(wsa881x->sd_n, 1); gpiod_direction_output(wsa881x->sd_n, 1);
wsa881x->regmap = devm_regmap_init_sdw(pdev, &wsa881x_regmap_config); wsa881x->regmap = devm_regmap_init_sdw(pdev, &wsa881x_regmap_config);
......
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