Re: [PATCH] soundwire: qcom: add SCP address paging support
From: Srinivas Kandagatla
Date: Mon Jul 06 2026 - 16:58:39 EST
On 7/6/26 8:21 PM, Jorijn van der Graaf wrote:
> The Qualcomm controller driver ignores the paging fields of struct
> sdw_msg. For a paged access (register address >= 0x8000 on a
> paging-capable peripheral, e.g. the SDCA control space at
> 0x40000000+) the core sets BIT(15) in the wire address and splits the
> upper bits into addr_page1/addr_page2, but since the controller never
> programmed the SCP_AddrPage registers the peripheral resolved every
> such command against their reset value: reads and writes were
> silently redirected to addr[14:0] in page 0.
>
> Write the two SCP_AddrPage registers through the command FIFO before
> the transfer, as cadence_master.c (cdns_program_scp_addr) and
> amd_manager.c (amd_program_scp_addr) do. Like those controllers the
> pages are programmed on every paged message rather than cached per
> device; a cache can be a follow-up if the two extra FIFO commands
> ever matter.
>
> No peripheral on a Qualcomm bus sets prop.paging_support in mainline
> today; the first user is the WCD9378 codec, whose driver is being
> upstreamed separately - its entire register map, the
> wcd937x-compatible analog core included, lives in the SDCA address
> space.
>
> Verified on the Fairphone 6 (SM7635): WCD9378 SDCA registers read
> back their documented reset defaults and audio capture through the
> codec works end-to-end; without this change every paged access landed
> in page 0.
>
> Assisted-by: Claude:claude-fable-5
> Signed-off-by: Jorijn van der Graaf <jorijnvdgraaf@xxxxxxxxxxxxx>
> ---
Thanks Jorjin for the patch, I have pretty much identical patch that I
was about to send.
LGTM,
Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@xxxxxxxxxxxxxxxx>
--srini
> drivers/soundwire/qcom.c | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c
> index 603f228f46b5..3562802f4204 100644
> --- a/drivers/soundwire/qcom.c
> +++ b/drivers/soundwire/qcom.c
> @@ -975,6 +975,20 @@ static enum sdw_command_response qcom_swrm_xfer_msg(struct sdw_bus *bus,
> struct qcom_swrm_ctrl *ctrl = to_qcom_sdw(bus);
> int ret, i, len;
>
> + if (msg->page) {
> + ret = qcom_swrm_cmd_fifo_wr_cmd(ctrl, msg->addr_page1,
> + msg->dev_num,
> + SDW_SCP_ADDRPAGE1);
> + if (ret)
> + return ret;
> +
> + ret = qcom_swrm_cmd_fifo_wr_cmd(ctrl, msg->addr_page2,
> + msg->dev_num,
> + SDW_SCP_ADDRPAGE2);
> + if (ret)
> + return ret;
> + }
> +
> if (msg->flags == SDW_MSG_FLAG_READ) {
> for (i = 0; i < msg->len;) {
> len = min(msg->len - i, QCOM_SWRM_MAX_RD_LEN);