2022-10-26 11:06:06

by Srinivas Kandagatla

[permalink] [raw]
Subject: [PATCH 0/6] soundwire: qcom: fixes and support for v1.7

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



2022-10-26 11:14:51

by Srinivas Kandagatla

[permalink] [raw]
Subject: [PATCH 4/6] soundwire: qcom: make reset optional for v1.6 controller

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 <[email protected]>
---
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


2022-10-26 11:17:30

by Srinivas Kandagatla

[permalink] [raw]
Subject: [PATCH 1/6] soundwire: qcom: reinit broadcast completion

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 <[email protected]>
---
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


2022-10-26 11:17:42

by Srinivas Kandagatla

[permalink] [raw]
Subject: [PATCH 3/6] soundwire: qcom: remove unused SWRM_SPECIAL_CMD_ID

Signed-off-by: Srinivas Kandagatla <[email protected]>
---
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


2022-10-26 11:27:04

by Srinivas Kandagatla

[permalink] [raw]
Subject: [PATCH 5/6] dt-bindings: soundwire: qcom: add v1.7.0 support

Signed-off-by: Srinivas Kandagatla <[email protected]>
---
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


2022-10-26 11:27:17

by Srinivas Kandagatla

[permalink] [raw]
Subject: [PATCH 6/6] soundwire: qcom: add support for v1.7 Soundwire Controller

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 <[email protected]>
---
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


2022-10-26 15:16:51

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH 5/6] dt-bindings: soundwire: qcom: add v1.7.0 support

On 26/10/2022 07:02, Srinivas Kandagatla wrote:
> Signed-off-by: Srinivas Kandagatla <[email protected]>
> ---
> Documentation/devicetree/bindings/soundwire/qcom,sdw.txt | 1 +


Acked-by: Krzysztof Kozlowski <[email protected]>

Best regards,
Krzysztof


2022-10-26 20:45:00

by Pierre-Louis Bossart

[permalink] [raw]
Subject: Re: [PATCH 6/6] soundwire: qcom: add support for v1.7 Soundwire Controller


> @@ -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?



2022-10-27 10:45:39

by Srinivas Kandagatla

[permalink] [raw]
Subject: Re: [PATCH 6/6] soundwire: qcom: add support for v1.7 Soundwire Controller

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

>

2022-10-27 14:41:31

by Pierre-Louis Bossart

[permalink] [raw]
Subject: Re: [PATCH 6/6] soundwire: qcom: add support for v1.7 Soundwire Controller


>>> @@ -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?

2022-10-28 11:45:25

by Vinod Koul

[permalink] [raw]
Subject: Re: [PATCH 0/6] soundwire: qcom: fixes and support for v1.7

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