Skip to content

Conversation

@man-rav
Copy link

@man-rav man-rav commented Jan 29, 2026

This change fixes SPF state handling. Previously opcode was forced in as the spf status queried which always is a positive numerical, not tracking the spf status accurately.

We fix here the status decoding by extracting status out of payload and refining the wait logic to signal after setting the status flags.

Playback and Capture use case has been validated on Rb3Gen2, with this change.

@man-rav man-rav requested review from a team January 29, 2026 11:14
@man-rav man-rav force-pushed the apm_spf_status_fix branch from 4013acd to 1741ff3 Compare January 29, 2026 14:37
@mohsRafi
Copy link
Contributor

@man-rav,

is this patches tested on actual target ?

Please confirm.

don't want to break existing setup, please update the PR description on which target tested this change


if (hdr->opcode == APM_CMD_RSP_GET_SPF_STATE) {
result = data->payload;
spf_status = (struct apm_cmd_rsp_get_spf_status_t *)(pkt+hdr_size);
Copy link
Contributor

@nandamajay nandamajay Jan 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spf_status is a struct, but you’re assigning a pointer to it and later dereferencing as spf_status->status. This is undefined and will likely crash.

Use‑before‑init for pkt / hdr_size : pkt and hdr_size are used without initializing.

Does this patch is validated , before submitting ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with respect to spf_status structure pointer, fixed this on a follow-up commit had issue syncing changes in fork with PR.

For the query on Use-Before-init for "hdr_size" & "pkt" pointer , line 607 & line 623-628 have these initialized and setup for usage on line 653.

Playback and Capture use case has been validated on Rb3Gen2, with this change.

q6apm callback function incorrectly processes SPF state responses
by using header opcode, this causes the spf to always appear up.
This change properly extracts the SPF status from the response payload
and correctly populates the result & status values for accurate SPF
state tracking. In addition push wait queue signalling to end of
callback as apm spf query function waits on this queue.

Signed-off-by: Manikantan R <manrav@qti.qualcomm.com>
update proble and remove callback to use devres managed api for
of_platform_populate.

Signed-off-by: Manikantan R <manrav@qti.qualcomm.com>
@man-rav man-rav force-pushed the apm_spf_status_fix branch from 1741ff3 to f2c1b6e Compare January 30, 2026 07:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants