All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/6] soundwire: qcom: fixes and support for v1.7
@ 2022-10-26 11:02 ` Srinivas Kandagatla
  0 siblings, 0 replies; 23+ messages in thread
From: Srinivas Kandagatla @ 2022-10-26 11:02 UTC (permalink / raw)
  To: vkoul, yung-chuan.liao
  Cc: andersson, robh+dt, krzysztof.kozlowski+dt, pierre-louis.bossart,
	sanyog.r.kale, srinivas.kandagatla, linux-arm-msm, devicetree,
	linux-kernel, alsa-devel

This patchset has 2 fixes around fifo handling adds support
for v1.7.0 controller found in SM8450 SoCs. Also a patch to
make reset optional for v1.6 as this is not required for sc8280xp.

Thanks,
Srini

Srinivas Kandagatla (6):
  soundwire: qcom: reinit broadcast completion
  soundwire: qcom: check for outanding writes before doing a read
  soundwire: qcom: remove unused SWRM_SPECIAL_CMD_ID
  soundwire: qcom: make reset optional for v1.6 controller
  dt-bindings: soundwire: qcom: add v1.7.0 support
  soundwire: qcom: add support for v1.7 Soundwire Controller

 .../bindings/soundwire/qcom,sdw.txt           |  1 +
 drivers/soundwire/qcom.c                      | 34 ++++++++++++++++---
 2 files changed, 30 insertions(+), 5 deletions(-)

-- 
2.21.0


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

* [PATCH 0/6] soundwire: qcom: fixes and support for v1.7
@ 2022-10-26 11:02 ` Srinivas Kandagatla
  0 siblings, 0 replies; 23+ messages in thread
From: Srinivas Kandagatla @ 2022-10-26 11:02 UTC (permalink / raw)
  To: vkoul, yung-chuan.liao
  Cc: devicetree, alsa-devel, linux-arm-msm, andersson,
	pierre-louis.bossart, linux-kernel, robh+dt, srinivas.kandagatla,
	krzysztof.kozlowski+dt, sanyog.r.kale

This patchset has 2 fixes around fifo handling adds support
for v1.7.0 controller found in SM8450 SoCs. Also a patch to
make reset optional for v1.6 as this is not required for sc8280xp.

Thanks,
Srini

Srinivas Kandagatla (6):
  soundwire: qcom: reinit broadcast completion
  soundwire: qcom: check for outanding writes before doing a read
  soundwire: qcom: remove unused SWRM_SPECIAL_CMD_ID
  soundwire: qcom: make reset optional for v1.6 controller
  dt-bindings: soundwire: qcom: add v1.7.0 support
  soundwire: qcom: add support for v1.7 Soundwire Controller

 .../bindings/soundwire/qcom,sdw.txt           |  1 +
 drivers/soundwire/qcom.c                      | 34 ++++++++++++++++---
 2 files changed, 30 insertions(+), 5 deletions(-)

-- 
2.21.0


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

* [PATCH 1/6] soundwire: qcom: reinit broadcast completion
  2022-10-26 11:02 ` Srinivas Kandagatla
@ 2022-10-26 11:02   ` Srinivas Kandagatla
  -1 siblings, 0 replies; 23+ messages in thread
From: Srinivas Kandagatla @ 2022-10-26 11:02 UTC (permalink / raw)
  To: vkoul, yung-chuan.liao
  Cc: andersson, robh+dt, krzysztof.kozlowski+dt, pierre-louis.bossart,
	sanyog.r.kale, srinivas.kandagatla, linux-arm-msm, devicetree,
	linux-kernel, alsa-devel

For some reason we never reinit the broadcast completion, there is a
danger that broadcast commands could be treated as completed by driver
from previous complete status.
Fix this by reinitializing the completion before sending a broadcast command.

Fixes: ddea6cf7b619 ("soundwire: qcom: update register read/write routine")
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 drivers/soundwire/qcom.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c
index b33d5db494a5..8f1a1eb017a2 100644
--- a/drivers/soundwire/qcom.c
+++ b/drivers/soundwire/qcom.c
@@ -344,6 +344,9 @@ static int qcom_swrm_cmd_fifo_wr_cmd(struct qcom_swrm_ctrl *swrm, u8 cmd_data,
 	if (swrm_wait_for_wr_fifo_avail(swrm))
 		return SDW_CMD_FAIL_OTHER;
 
+	if (cmd_id == SWR_BROADCAST_CMD_ID)
+		reinit_completion(&swrm->broadcast);
+
 	/* Its assumed that write is okay as we do not get any status back */
 	swrm->reg_write(swrm, SWRM_CMD_FIFO_WR_CMD, val);
 
-- 
2.21.0


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

* [PATCH 1/6] soundwire: qcom: reinit broadcast completion
@ 2022-10-26 11:02   ` Srinivas Kandagatla
  0 siblings, 0 replies; 23+ messages in thread
From: Srinivas Kandagatla @ 2022-10-26 11:02 UTC (permalink / raw)
  To: vkoul, yung-chuan.liao
  Cc: devicetree, alsa-devel, linux-arm-msm, andersson,
	pierre-louis.bossart, linux-kernel, robh+dt, srinivas.kandagatla,
	krzysztof.kozlowski+dt, sanyog.r.kale

For some reason we never reinit the broadcast completion, there is a
danger that broadcast commands could be treated as completed by driver
from previous complete status.
Fix this by reinitializing the completion before sending a broadcast command.

Fixes: ddea6cf7b619 ("soundwire: qcom: update register read/write routine")
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 drivers/soundwire/qcom.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c
index b33d5db494a5..8f1a1eb017a2 100644
--- a/drivers/soundwire/qcom.c
+++ b/drivers/soundwire/qcom.c
@@ -344,6 +344,9 @@ static int qcom_swrm_cmd_fifo_wr_cmd(struct qcom_swrm_ctrl *swrm, u8 cmd_data,
 	if (swrm_wait_for_wr_fifo_avail(swrm))
 		return SDW_CMD_FAIL_OTHER;
 
+	if (cmd_id == SWR_BROADCAST_CMD_ID)
+		reinit_completion(&swrm->broadcast);
+
 	/* Its assumed that write is okay as we do not get any status back */
 	swrm->reg_write(swrm, SWRM_CMD_FIFO_WR_CMD, val);
 
-- 
2.21.0


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

* [PATCH 2/6] soundwire: qcom: check for outanding writes before doing a read
  2022-10-26 11:02 ` Srinivas Kandagatla
@ 2022-10-26 11:02   ` Srinivas Kandagatla
  -1 siblings, 0 replies; 23+ messages in thread
From: Srinivas Kandagatla @ 2022-10-26 11:02 UTC (permalink / raw)
  To: vkoul, yung-chuan.liao
  Cc: andersson, robh+dt, krzysztof.kozlowski+dt, pierre-louis.bossart,
	sanyog.r.kale, srinivas.kandagatla, linux-arm-msm, devicetree,
	linux-kernel, alsa-devel

Reading will increase the fifo count, so check for outstanding cmd wrt.
write fifo depth to avoid overflow as read will also increase
write fifo cnt.

Fixes: a661308c34de ("soundwire: qcom: wait for fifo space to be available before read/write")
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 drivers/soundwire/qcom.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c
index 8f1a1eb017a2..cee2b2223141 100644
--- a/drivers/soundwire/qcom.c
+++ b/drivers/soundwire/qcom.c
@@ -380,6 +380,12 @@ static int qcom_swrm_cmd_fifo_rd_cmd(struct qcom_swrm_ctrl *swrm,
 
 	val = swrm_get_packed_reg_val(&swrm->rcmd_id, len, dev_addr, reg_addr);
 
+	/*
+	 * Check for outstanding cmd wrt. write fifo depth to avoid
+	 * overflow as read will also increase write fifo cnt.
+	 */
+	swrm_wait_for_wr_fifo_avail(swrm);
+
 	/* wait for FIFO RD to complete to avoid overflow */
 	usleep_range(100, 105);
 	swrm->reg_write(swrm, SWRM_CMD_FIFO_RD_CMD, val);
-- 
2.21.0


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

* [PATCH 2/6] soundwire: qcom: check for outanding writes before doing a read
@ 2022-10-26 11:02   ` Srinivas Kandagatla
  0 siblings, 0 replies; 23+ messages in thread
From: Srinivas Kandagatla @ 2022-10-26 11:02 UTC (permalink / raw)
  To: vkoul, yung-chuan.liao
  Cc: devicetree, alsa-devel, linux-arm-msm, andersson,
	pierre-louis.bossart, linux-kernel, robh+dt, srinivas.kandagatla,
	krzysztof.kozlowski+dt, sanyog.r.kale

Reading will increase the fifo count, so check for outstanding cmd wrt.
write fifo depth to avoid overflow as read will also increase
write fifo cnt.

Fixes: a661308c34de ("soundwire: qcom: wait for fifo space to be available before read/write")
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 drivers/soundwire/qcom.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c
index 8f1a1eb017a2..cee2b2223141 100644
--- a/drivers/soundwire/qcom.c
+++ b/drivers/soundwire/qcom.c
@@ -380,6 +380,12 @@ static int qcom_swrm_cmd_fifo_rd_cmd(struct qcom_swrm_ctrl *swrm,
 
 	val = swrm_get_packed_reg_val(&swrm->rcmd_id, len, dev_addr, reg_addr);
 
+	/*
+	 * Check for outstanding cmd wrt. write fifo depth to avoid
+	 * overflow as read will also increase write fifo cnt.
+	 */
+	swrm_wait_for_wr_fifo_avail(swrm);
+
 	/* wait for FIFO RD to complete to avoid overflow */
 	usleep_range(100, 105);
 	swrm->reg_write(swrm, SWRM_CMD_FIFO_RD_CMD, val);
-- 
2.21.0


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

* [PATCH 3/6] soundwire: qcom: remove unused SWRM_SPECIAL_CMD_ID
  2022-10-26 11:02 ` Srinivas Kandagatla
@ 2022-10-26 11:02   ` Srinivas Kandagatla
  -1 siblings, 0 replies; 23+ messages in thread
From: Srinivas Kandagatla @ 2022-10-26 11:02 UTC (permalink / raw)
  To: vkoul, yung-chuan.liao
  Cc: andersson, robh+dt, krzysztof.kozlowski+dt, pierre-louis.bossart,
	sanyog.r.kale, srinivas.kandagatla, linux-arm-msm, devicetree,
	linux-kernel, alsa-devel

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 drivers/soundwire/qcom.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c
index cee2b2223141..7bc8cd0e906b 100644
--- a/drivers/soundwire/qcom.c
+++ b/drivers/soundwire/qcom.c
@@ -104,7 +104,6 @@
 #define SWRM_REG_VAL_PACK(data, dev, id, reg)	\
 			((reg) | ((id) << 16) | ((dev) << 20) | ((data) << 24))
 
-#define SWRM_SPECIAL_CMD_ID	0xF
 #define MAX_FREQ_NUM		1
 #define TIMEOUT_MS		100
 #define QCOM_SWRM_MAX_RD_LEN	0x1
-- 
2.21.0


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

* [PATCH 3/6] soundwire: qcom: remove unused SWRM_SPECIAL_CMD_ID
@ 2022-10-26 11:02   ` Srinivas Kandagatla
  0 siblings, 0 replies; 23+ messages in thread
From: Srinivas Kandagatla @ 2022-10-26 11:02 UTC (permalink / raw)
  To: vkoul, yung-chuan.liao
  Cc: devicetree, alsa-devel, linux-arm-msm, andersson,
	pierre-louis.bossart, linux-kernel, robh+dt, srinivas.kandagatla,
	krzysztof.kozlowski+dt, sanyog.r.kale

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 drivers/soundwire/qcom.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c
index cee2b2223141..7bc8cd0e906b 100644
--- a/drivers/soundwire/qcom.c
+++ b/drivers/soundwire/qcom.c
@@ -104,7 +104,6 @@
 #define SWRM_REG_VAL_PACK(data, dev, id, reg)	\
 			((reg) | ((id) << 16) | ((dev) << 20) | ((data) << 24))
 
-#define SWRM_SPECIAL_CMD_ID	0xF
 #define MAX_FREQ_NUM		1
 #define TIMEOUT_MS		100
 #define QCOM_SWRM_MAX_RD_LEN	0x1
-- 
2.21.0


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

* [PATCH 4/6] soundwire: qcom: make reset optional for v1.6 controller
  2022-10-26 11:02 ` Srinivas Kandagatla
@ 2022-10-26 11:02   ` Srinivas Kandagatla
  -1 siblings, 0 replies; 23+ messages in thread
From: Srinivas Kandagatla @ 2022-10-26 11:02 UTC (permalink / raw)
  To: vkoul, yung-chuan.liao
  Cc: andersson, robh+dt, krzysztof.kozlowski+dt, pierre-louis.bossart,
	sanyog.r.kale, srinivas.kandagatla, linux-arm-msm, devicetree,
	linux-kernel, alsa-devel

On Some Qualcomm SOCs like sc8280xp which uses v1.6 soundwire controller
reset is not mandatory, so make this an optional one.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 drivers/soundwire/qcom.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c
index 7bc8cd0e906b..54d370f4b291 100644
--- a/drivers/soundwire/qcom.c
+++ b/drivers/soundwire/qcom.c
@@ -1330,8 +1330,8 @@ static int qcom_swrm_probe(struct platform_device *pdev)
 	}
 
 	if (data->sw_clk_gate_required) {
-		ctrl->audio_cgcr = devm_reset_control_get_exclusive(dev, "swr_audio_cgcr");
-		if (IS_ERR_OR_NULL(ctrl->audio_cgcr)) {
+		ctrl->audio_cgcr = devm_reset_control_get_optional_exclusive(dev, "swr_audio_cgcr");
+		if (IS_ERR(ctrl->audio_cgcr)) {
 			dev_err(dev, "Failed to get cgcr reset ctrl required for SW gating\n");
 			ret = PTR_ERR(ctrl->audio_cgcr);
 			goto err_init;
-- 
2.21.0


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

* [PATCH 4/6] soundwire: qcom: make reset optional for v1.6 controller
@ 2022-10-26 11:02   ` Srinivas Kandagatla
  0 siblings, 0 replies; 23+ messages in thread
From: Srinivas Kandagatla @ 2022-10-26 11:02 UTC (permalink / raw)
  To: vkoul, yung-chuan.liao
  Cc: devicetree, alsa-devel, linux-arm-msm, andersson,
	pierre-louis.bossart, linux-kernel, robh+dt, srinivas.kandagatla,
	krzysztof.kozlowski+dt, sanyog.r.kale

On Some Qualcomm SOCs like sc8280xp which uses v1.6 soundwire controller
reset is not mandatory, so make this an optional one.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 drivers/soundwire/qcom.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c
index 7bc8cd0e906b..54d370f4b291 100644
--- a/drivers/soundwire/qcom.c
+++ b/drivers/soundwire/qcom.c
@@ -1330,8 +1330,8 @@ static int qcom_swrm_probe(struct platform_device *pdev)
 	}
 
 	if (data->sw_clk_gate_required) {
-		ctrl->audio_cgcr = devm_reset_control_get_exclusive(dev, "swr_audio_cgcr");
-		if (IS_ERR_OR_NULL(ctrl->audio_cgcr)) {
+		ctrl->audio_cgcr = devm_reset_control_get_optional_exclusive(dev, "swr_audio_cgcr");
+		if (IS_ERR(ctrl->audio_cgcr)) {
 			dev_err(dev, "Failed to get cgcr reset ctrl required for SW gating\n");
 			ret = PTR_ERR(ctrl->audio_cgcr);
 			goto err_init;
-- 
2.21.0


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

* [PATCH 5/6] dt-bindings: soundwire: qcom: add v1.7.0 support
  2022-10-26 11:02 ` Srinivas Kandagatla
@ 2022-10-26 11:02   ` Srinivas Kandagatla
  -1 siblings, 0 replies; 23+ messages in thread
From: Srinivas Kandagatla @ 2022-10-26 11:02 UTC (permalink / raw)
  To: vkoul, yung-chuan.liao
  Cc: andersson, robh+dt, krzysztof.kozlowski+dt, pierre-louis.bossart,
	sanyog.r.kale, srinivas.kandagatla, linux-arm-msm, devicetree,
	linux-kernel, alsa-devel

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 Documentation/devicetree/bindings/soundwire/qcom,sdw.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/soundwire/qcom,sdw.txt b/Documentation/devicetree/bindings/soundwire/qcom,sdw.txt
index c85c25779e3f..e0faed8dceac 100644
--- a/Documentation/devicetree/bindings/soundwire/qcom,sdw.txt
+++ b/Documentation/devicetree/bindings/soundwire/qcom,sdw.txt
@@ -13,6 +13,7 @@ board specific bus parameters.
 			"qcom,soundwire-v1.5.0"
 			"qcom,soundwire-v1.5.1"
 			"qcom,soundwire-v1.6.0"
+			"qcom,soundwire-v1.7.0"
 - reg:
 	Usage: required
 	Value type: <prop-encoded-array>
-- 
2.21.0


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

* [PATCH 5/6] dt-bindings: soundwire: qcom: add v1.7.0 support
@ 2022-10-26 11:02   ` Srinivas Kandagatla
  0 siblings, 0 replies; 23+ messages in thread
From: Srinivas Kandagatla @ 2022-10-26 11:02 UTC (permalink / raw)
  To: vkoul, yung-chuan.liao
  Cc: devicetree, alsa-devel, linux-arm-msm, andersson,
	pierre-louis.bossart, linux-kernel, robh+dt, srinivas.kandagatla,
	krzysztof.kozlowski+dt, sanyog.r.kale

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 Documentation/devicetree/bindings/soundwire/qcom,sdw.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/soundwire/qcom,sdw.txt b/Documentation/devicetree/bindings/soundwire/qcom,sdw.txt
index c85c25779e3f..e0faed8dceac 100644
--- a/Documentation/devicetree/bindings/soundwire/qcom,sdw.txt
+++ b/Documentation/devicetree/bindings/soundwire/qcom,sdw.txt
@@ -13,6 +13,7 @@ board specific bus parameters.
 			"qcom,soundwire-v1.5.0"
 			"qcom,soundwire-v1.5.1"
 			"qcom,soundwire-v1.6.0"
+			"qcom,soundwire-v1.7.0"
 - reg:
 	Usage: required
 	Value type: <prop-encoded-array>
-- 
2.21.0


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

* [PATCH 6/6] soundwire: qcom: add support for v1.7 Soundwire Controller
  2022-10-26 11:02 ` Srinivas Kandagatla
@ 2022-10-26 11:02   ` Srinivas Kandagatla
  -1 siblings, 0 replies; 23+ messages in thread
From: Srinivas Kandagatla @ 2022-10-26 11:02 UTC (permalink / raw)
  To: vkoul, yung-chuan.liao
  Cc: andersson, robh+dt, krzysztof.kozlowski+dt, pierre-louis.bossart,
	sanyog.r.kale, srinivas.kandagatla, linux-arm-msm, devicetree,
	linux-kernel, alsa-devel

This patch add support for v1.7 SoundWire Controller which has
support for Multi-EE (Execution Environment), resulting in a
new register and extending field in BUS_CTRL register.

With these updates v1.7.0 is fully supported.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 drivers/soundwire/qcom.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c
index 54d370f4b291..335424870290 100644
--- a/drivers/soundwire/qcom.c
+++ b/drivers/soundwire/qcom.c
@@ -25,6 +25,8 @@
 
 #define SWRM_COMP_SW_RESET					0x008
 #define SWRM_COMP_STATUS					0x014
+#define SWRM_LINK_MANAGER_EE					0x018
+#define SWRM_EE_CPU						1
 #define SWRM_FRM_GEN_ENABLED					BIT(0)
 #define SWRM_COMP_HW_VERSION					0x00
 #define SWRM_COMP_CFG_ADDR					0x04
@@ -693,7 +695,14 @@ static int qcom_swrm_init(struct qcom_swrm_ctrl *ctrl)
 	u32p_replace_bits(&val, SWRM_DEF_CMD_NO_PINGS, SWRM_MCP_CFG_MAX_NUM_OF_CMD_NO_PINGS_BMSK);
 	ctrl->reg_write(ctrl, SWRM_MCP_CFG_ADDR, val);
 
-	ctrl->reg_write(ctrl, SWRM_MCP_BUS_CTRL, SWRM_MCP_BUS_CLK_START);
+	if (ctrl->version >= 0x01070000) {
+		ctrl->reg_write(ctrl, SWRM_LINK_MANAGER_EE, SWRM_EE_CPU);
+		ctrl->reg_write(ctrl, SWRM_MCP_BUS_CTRL,
+				SWRM_MCP_BUS_CLK_START << SWRM_EE_CPU);
+	} else {
+		ctrl->reg_write(ctrl, SWRM_MCP_BUS_CTRL, SWRM_MCP_BUS_CLK_START);
+	}
+
 	/* Configure number of retries of a read/write cmd */
 	if (ctrl->version > 0x01050001) {
 		/* Only for versions >= 1.5.1 */
@@ -1518,7 +1527,13 @@ static int __maybe_unused swrm_runtime_resume(struct device *dev)
 	} else {
 		reset_control_reset(ctrl->audio_cgcr);
 
-		ctrl->reg_write(ctrl, SWRM_MCP_BUS_CTRL, SWRM_MCP_BUS_CLK_START);
+		if (ctrl->version >= 0x01070000) {
+			ctrl->reg_write(ctrl, SWRM_LINK_MANAGER_EE, SWRM_EE_CPU);
+			ctrl->reg_write(ctrl, SWRM_MCP_BUS_CTRL,
+					SWRM_MCP_BUS_CLK_START << SWRM_EE_CPU);
+		} else {
+			ctrl->reg_write(ctrl, SWRM_MCP_BUS_CTRL, SWRM_MCP_BUS_CLK_START);
+		}
 		ctrl->reg_write(ctrl, SWRM_INTERRUPT_CLEAR,
 			SWRM_INTERRUPT_STATUS_MASTER_CLASH_DET);
 
@@ -1582,6 +1597,7 @@ static const struct of_device_id qcom_swrm_of_match[] = {
 	{ .compatible = "qcom,soundwire-v1.3.0", .data = &swrm_v1_3_data },
 	{ .compatible = "qcom,soundwire-v1.5.1", .data = &swrm_v1_5_data },
 	{ .compatible = "qcom,soundwire-v1.6.0", .data = &swrm_v1_6_data },
+	{ .compatible = "qcom,soundwire-v1.7.0", .data = &swrm_v1_5_data },
 	{/* sentinel */},
 };
 
-- 
2.21.0


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

* [PATCH 6/6] soundwire: qcom: add support for v1.7 Soundwire Controller
@ 2022-10-26 11:02   ` Srinivas Kandagatla
  0 siblings, 0 replies; 23+ messages in thread
From: Srinivas Kandagatla @ 2022-10-26 11:02 UTC (permalink / raw)
  To: vkoul, yung-chuan.liao
  Cc: devicetree, alsa-devel, linux-arm-msm, andersson,
	pierre-louis.bossart, linux-kernel, robh+dt, srinivas.kandagatla,
	krzysztof.kozlowski+dt, sanyog.r.kale

This patch add support for v1.7 SoundWire Controller which has
support for Multi-EE (Execution Environment), resulting in a
new register and extending field in BUS_CTRL register.

With these updates v1.7.0 is fully supported.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 drivers/soundwire/qcom.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c
index 54d370f4b291..335424870290 100644
--- a/drivers/soundwire/qcom.c
+++ b/drivers/soundwire/qcom.c
@@ -25,6 +25,8 @@
 
 #define SWRM_COMP_SW_RESET					0x008
 #define SWRM_COMP_STATUS					0x014
+#define SWRM_LINK_MANAGER_EE					0x018
+#define SWRM_EE_CPU						1
 #define SWRM_FRM_GEN_ENABLED					BIT(0)
 #define SWRM_COMP_HW_VERSION					0x00
 #define SWRM_COMP_CFG_ADDR					0x04
@@ -693,7 +695,14 @@ static int qcom_swrm_init(struct qcom_swrm_ctrl *ctrl)
 	u32p_replace_bits(&val, SWRM_DEF_CMD_NO_PINGS, SWRM_MCP_CFG_MAX_NUM_OF_CMD_NO_PINGS_BMSK);
 	ctrl->reg_write(ctrl, SWRM_MCP_CFG_ADDR, val);
 
-	ctrl->reg_write(ctrl, SWRM_MCP_BUS_CTRL, SWRM_MCP_BUS_CLK_START);
+	if (ctrl->version >= 0x01070000) {
+		ctrl->reg_write(ctrl, SWRM_LINK_MANAGER_EE, SWRM_EE_CPU);
+		ctrl->reg_write(ctrl, SWRM_MCP_BUS_CTRL,
+				SWRM_MCP_BUS_CLK_START << SWRM_EE_CPU);
+	} else {
+		ctrl->reg_write(ctrl, SWRM_MCP_BUS_CTRL, SWRM_MCP_BUS_CLK_START);
+	}
+
 	/* Configure number of retries of a read/write cmd */
 	if (ctrl->version > 0x01050001) {
 		/* Only for versions >= 1.5.1 */
@@ -1518,7 +1527,13 @@ static int __maybe_unused swrm_runtime_resume(struct device *dev)
 	} else {
 		reset_control_reset(ctrl->audio_cgcr);
 
-		ctrl->reg_write(ctrl, SWRM_MCP_BUS_CTRL, SWRM_MCP_BUS_CLK_START);
+		if (ctrl->version >= 0x01070000) {
+			ctrl->reg_write(ctrl, SWRM_LINK_MANAGER_EE, SWRM_EE_CPU);
+			ctrl->reg_write(ctrl, SWRM_MCP_BUS_CTRL,
+					SWRM_MCP_BUS_CLK_START << SWRM_EE_CPU);
+		} else {
+			ctrl->reg_write(ctrl, SWRM_MCP_BUS_CTRL, SWRM_MCP_BUS_CLK_START);
+		}
 		ctrl->reg_write(ctrl, SWRM_INTERRUPT_CLEAR,
 			SWRM_INTERRUPT_STATUS_MASTER_CLASH_DET);
 
@@ -1582,6 +1597,7 @@ static const struct of_device_id qcom_swrm_of_match[] = {
 	{ .compatible = "qcom,soundwire-v1.3.0", .data = &swrm_v1_3_data },
 	{ .compatible = "qcom,soundwire-v1.5.1", .data = &swrm_v1_5_data },
 	{ .compatible = "qcom,soundwire-v1.6.0", .data = &swrm_v1_6_data },
+	{ .compatible = "qcom,soundwire-v1.7.0", .data = &swrm_v1_5_data },
 	{/* sentinel */},
 };
 
-- 
2.21.0


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

* Re: [PATCH 5/6] dt-bindings: soundwire: qcom: add v1.7.0 support
  2022-10-26 11:02   ` Srinivas Kandagatla
@ 2022-10-26 14:28     ` Krzysztof Kozlowski
  -1 siblings, 0 replies; 23+ messages in thread
From: Krzysztof Kozlowski @ 2022-10-26 14:28 UTC (permalink / raw)
  To: Srinivas Kandagatla, vkoul, yung-chuan.liao
  Cc: andersson, robh+dt, krzysztof.kozlowski+dt, pierre-louis.bossart,
	sanyog.r.kale, linux-arm-msm, devicetree, linux-kernel,
	alsa-devel

On 26/10/2022 07:02, Srinivas Kandagatla wrote:
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> ---
>  Documentation/devicetree/bindings/soundwire/qcom,sdw.txt | 1 +


Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Best regards,
Krzysztof


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

* Re: [PATCH 5/6] dt-bindings: soundwire: qcom: add v1.7.0 support
@ 2022-10-26 14:28     ` Krzysztof Kozlowski
  0 siblings, 0 replies; 23+ messages in thread
From: Krzysztof Kozlowski @ 2022-10-26 14:28 UTC (permalink / raw)
  To: Srinivas Kandagatla, vkoul, yung-chuan.liao
  Cc: devicetree, alsa-devel, linux-arm-msm, andersson,
	pierre-louis.bossart, linux-kernel, robh+dt,
	krzysztof.kozlowski+dt, sanyog.r.kale

On 26/10/2022 07:02, Srinivas Kandagatla wrote:
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> ---
>  Documentation/devicetree/bindings/soundwire/qcom,sdw.txt | 1 +


Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Best regards,
Krzysztof


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

* Re: [PATCH 6/6] soundwire: qcom: add support for v1.7 Soundwire Controller
  2022-10-26 11:02   ` Srinivas Kandagatla
@ 2022-10-26 20:14     ` Pierre-Louis Bossart
  -1 siblings, 0 replies; 23+ messages in thread
From: Pierre-Louis Bossart @ 2022-10-26 20:14 UTC (permalink / raw)
  To: Srinivas Kandagatla, vkoul, yung-chuan.liao
  Cc: andersson, robh+dt, krzysztof.kozlowski+dt, sanyog.r.kale,
	linux-arm-msm, devicetree, linux-kernel, alsa-devel


> @@ -1582,6 +1597,7 @@ static const struct of_device_id qcom_swrm_of_match[] = {
>  	{ .compatible = "qcom,soundwire-v1.3.0", .data = &swrm_v1_3_data },
>  	{ .compatible = "qcom,soundwire-v1.5.1", .data = &swrm_v1_5_data },
>  	{ .compatible = "qcom,soundwire-v1.6.0", .data = &swrm_v1_6_data },
> +	{ .compatible = "qcom,soundwire-v1.7.0", .data = &swrm_v1_5_data },

is this line intentional, it looks odd that 1.7 is compatible with 1.5,
but 1.6 isn't?



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

* Re: [PATCH 6/6] soundwire: qcom: add support for v1.7 Soundwire Controller
@ 2022-10-26 20:14     ` Pierre-Louis Bossart
  0 siblings, 0 replies; 23+ messages in thread
From: Pierre-Louis Bossart @ 2022-10-26 20:14 UTC (permalink / raw)
  To: Srinivas Kandagatla, vkoul, yung-chuan.liao
  Cc: devicetree, alsa-devel, linux-arm-msm, andersson, linux-kernel,
	robh+dt, krzysztof.kozlowski+dt, sanyog.r.kale


> @@ -1582,6 +1597,7 @@ static const struct of_device_id qcom_swrm_of_match[] = {
>  	{ .compatible = "qcom,soundwire-v1.3.0", .data = &swrm_v1_3_data },
>  	{ .compatible = "qcom,soundwire-v1.5.1", .data = &swrm_v1_5_data },
>  	{ .compatible = "qcom,soundwire-v1.6.0", .data = &swrm_v1_6_data },
> +	{ .compatible = "qcom,soundwire-v1.7.0", .data = &swrm_v1_5_data },

is this line intentional, it looks odd that 1.7 is compatible with 1.5,
but 1.6 isn't?



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

* Re: [PATCH 6/6] soundwire: qcom: add support for v1.7 Soundwire Controller
  2022-10-26 20:14     ` Pierre-Louis Bossart
@ 2022-10-27 10:19       ` Srinivas Kandagatla
  -1 siblings, 0 replies; 23+ messages in thread
From: Srinivas Kandagatla @ 2022-10-27 10:19 UTC (permalink / raw)
  To: Pierre-Louis Bossart, vkoul, yung-chuan.liao
  Cc: andersson, robh+dt, krzysztof.kozlowski+dt, sanyog.r.kale,
	linux-arm-msm, devicetree, linux-kernel, alsa-devel

Hi Pierre,

On 26/10/2022 21:14, Pierre-Louis Bossart wrote:
> 
>> @@ -1582,6 +1597,7 @@ static const struct of_device_id qcom_swrm_of_match[] = {
>>   	{ .compatible = "qcom,soundwire-v1.3.0", .data = &swrm_v1_3_data },
>>   	{ .compatible = "qcom,soundwire-v1.5.1", .data = &swrm_v1_5_data },
>>   	{ .compatible = "qcom,soundwire-v1.6.0", .data = &swrm_v1_6_data },
>> +	{ .compatible = "qcom,soundwire-v1.7.0", .data = &swrm_v1_5_data },
> 
> is this line intentional, it looks odd that 1.7 is compatible with 1.5,
> but 1.6 isn't?
This is more around the data rather than compatible, 1.6 data is marked 
with sw_clk_gate_required = true which is not the case with 1.7.

from 1.5 we use same frame shape info for 1.6, 1.7, except that 1.6 had 
this sw_clk_gate_required flag set.

--srini

> 

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

* Re: [PATCH 6/6] soundwire: qcom: add support for v1.7 Soundwire Controller
@ 2022-10-27 10:19       ` Srinivas Kandagatla
  0 siblings, 0 replies; 23+ messages in thread
From: Srinivas Kandagatla @ 2022-10-27 10:19 UTC (permalink / raw)
  To: Pierre-Louis Bossart, vkoul, yung-chuan.liao
  Cc: devicetree, alsa-devel, linux-arm-msm, andersson, linux-kernel,
	robh+dt, krzysztof.kozlowski+dt, sanyog.r.kale

Hi Pierre,

On 26/10/2022 21:14, Pierre-Louis Bossart wrote:
> 
>> @@ -1582,6 +1597,7 @@ static const struct of_device_id qcom_swrm_of_match[] = {
>>   	{ .compatible = "qcom,soundwire-v1.3.0", .data = &swrm_v1_3_data },
>>   	{ .compatible = "qcom,soundwire-v1.5.1", .data = &swrm_v1_5_data },
>>   	{ .compatible = "qcom,soundwire-v1.6.0", .data = &swrm_v1_6_data },
>> +	{ .compatible = "qcom,soundwire-v1.7.0", .data = &swrm_v1_5_data },
> 
> is this line intentional, it looks odd that 1.7 is compatible with 1.5,
> but 1.6 isn't?
This is more around the data rather than compatible, 1.6 data is marked 
with sw_clk_gate_required = true which is not the case with 1.7.

from 1.5 we use same frame shape info for 1.6, 1.7, except that 1.6 had 
this sw_clk_gate_required flag set.

--srini

> 

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

* Re: [PATCH 6/6] soundwire: qcom: add support for v1.7 Soundwire Controller
  2022-10-27 10:19       ` Srinivas Kandagatla
  (?)
@ 2022-10-27 12:45       ` Pierre-Louis Bossart
  -1 siblings, 0 replies; 23+ messages in thread
From: Pierre-Louis Bossart @ 2022-10-27 12:45 UTC (permalink / raw)
  To: Srinivas Kandagatla, vkoul, yung-chuan.liao
  Cc: devicetree, alsa-devel, linux-arm-msm, andersson, linux-kernel,
	robh+dt, krzysztof.kozlowski+dt, sanyog.r.kale


>>> @@ -1582,6 +1597,7 @@ static const struct of_device_id
>>> qcom_swrm_of_match[] = {
>>>       { .compatible = "qcom,soundwire-v1.3.0", .data =
>>> &swrm_v1_3_data },
>>>       { .compatible = "qcom,soundwire-v1.5.1", .data =
>>> &swrm_v1_5_data },
>>>       { .compatible = "qcom,soundwire-v1.6.0", .data =
>>> &swrm_v1_6_data },
>>> +    { .compatible = "qcom,soundwire-v1.7.0", .data = &swrm_v1_5_data },
>>
>> is this line intentional, it looks odd that 1.7 is compatible with 1.5,
>> but 1.6 isn't?
> This is more around the data rather than compatible, 1.6 data is marked
> with sw_clk_gate_required = true which is not the case with 1.7.
> 
> from 1.5 we use same frame shape info for 1.6, 1.7, except that 1.6 had
> this sw_clk_gate_required flag set.

probably worthy of a comment to show intent and explain the differences?

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

* Re: [PATCH 0/6] soundwire: qcom: fixes and support for v1.7
  2022-10-26 11:02 ` Srinivas Kandagatla
@ 2022-10-28 11:31   ` Vinod Koul
  -1 siblings, 0 replies; 23+ messages in thread
From: Vinod Koul @ 2022-10-28 11:31 UTC (permalink / raw)
  To: Srinivas Kandagatla
  Cc: yung-chuan.liao, andersson, robh+dt, krzysztof.kozlowski+dt,
	pierre-louis.bossart, sanyog.r.kale, linux-arm-msm, devicetree,
	linux-kernel, alsa-devel

On 26-10-22, 12:02, Srinivas Kandagatla wrote:
> This patchset has 2 fixes around fifo handling adds support
> for v1.7.0 controller found in SM8450 SoCs. Also a patch to
> make reset optional for v1.6 as this is not required for sc8280xp.

Applied, thanks

-- 
~Vinod

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

* Re: [PATCH 0/6] soundwire: qcom: fixes and support for v1.7
@ 2022-10-28 11:31   ` Vinod Koul
  0 siblings, 0 replies; 23+ messages in thread
From: Vinod Koul @ 2022-10-28 11:31 UTC (permalink / raw)
  To: Srinivas Kandagatla
  Cc: devicetree, alsa-devel, linux-arm-msm, andersson,
	pierre-louis.bossart, linux-kernel, robh+dt,
	krzysztof.kozlowski+dt, sanyog.r.kale, yung-chuan.liao

On 26-10-22, 12:02, Srinivas Kandagatla wrote:
> This patchset has 2 fixes around fifo handling adds support
> for v1.7.0 controller found in SM8450 SoCs. Also a patch to
> make reset optional for v1.6 as this is not required for sc8280xp.

Applied, thanks

-- 
~Vinod

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

end of thread, other threads:[~2022-10-28 11:32 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-26 11:02 [PATCH 0/6] soundwire: qcom: fixes and support for v1.7 Srinivas Kandagatla
2022-10-26 11:02 ` Srinivas Kandagatla
2022-10-26 11:02 ` [PATCH 1/6] soundwire: qcom: reinit broadcast completion Srinivas Kandagatla
2022-10-26 11:02   ` Srinivas Kandagatla
2022-10-26 11:02 ` [PATCH 2/6] soundwire: qcom: check for outanding writes before doing a read Srinivas Kandagatla
2022-10-26 11:02   ` Srinivas Kandagatla
2022-10-26 11:02 ` [PATCH 3/6] soundwire: qcom: remove unused SWRM_SPECIAL_CMD_ID Srinivas Kandagatla
2022-10-26 11:02   ` Srinivas Kandagatla
2022-10-26 11:02 ` [PATCH 4/6] soundwire: qcom: make reset optional for v1.6 controller Srinivas Kandagatla
2022-10-26 11:02   ` Srinivas Kandagatla
2022-10-26 11:02 ` [PATCH 5/6] dt-bindings: soundwire: qcom: add v1.7.0 support Srinivas Kandagatla
2022-10-26 11:02   ` Srinivas Kandagatla
2022-10-26 14:28   ` Krzysztof Kozlowski
2022-10-26 14:28     ` Krzysztof Kozlowski
2022-10-26 11:02 ` [PATCH 6/6] soundwire: qcom: add support for v1.7 Soundwire Controller Srinivas Kandagatla
2022-10-26 11:02   ` Srinivas Kandagatla
2022-10-26 20:14   ` Pierre-Louis Bossart
2022-10-26 20:14     ` Pierre-Louis Bossart
2022-10-27 10:19     ` Srinivas Kandagatla
2022-10-27 10:19       ` Srinivas Kandagatla
2022-10-27 12:45       ` Pierre-Louis Bossart
2022-10-28 11:31 ` [PATCH 0/6] soundwire: qcom: fixes and support for v1.7 Vinod Koul
2022-10-28 11:31   ` Vinod Koul

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.