Skip to content

ASoC: SOF: Intel: ptl: Move the mic privacy change IPC sending to a work#5371

Merged
ranj063 merged 1 commit intothesofproject:topic/sof-devfrom
ujfalusi:peter/sof/pr/ptl_sdw_mic_privacy_handling_04
Mar 27, 2025
Merged

ASoC: SOF: Intel: ptl: Move the mic privacy change IPC sending to a work#5371
ranj063 merged 1 commit intothesofproject:topic/sof-devfrom
ujfalusi:peter/sof/pr/ptl_sdw_mic_privacy_handling_04

Conversation

@ujfalusi
Copy link
Collaborator

IPCs cannot be sent directly form the irq thread as we would net get the reply (interrupt is disabled).

Introduce a new struct to handle to delayed notification handling.

@ujfalusi ujfalusi changed the title ASoC: SOF: Intel: ptl: MOve the mic privacy change IPC sending to a work ASoC: SOF: Intel: ptl: Move the mic privacy change IPC sending to a work Mar 21, 2025
if (nhlt)
intel_nhlt_free(nhlt);

if (!sdev->dspless_mode_selected)
Copy link
Collaborator

Choose a reason for hiding this comment

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

typo in the commit message : to the firmware

@ujfalusi ujfalusi force-pushed the peter/sof/pr/ptl_sdw_mic_privacy_handling_04 branch from 53203bf to 2fa25aa Compare March 24, 2025 07:18
@ujfalusi
Copy link
Collaborator Author

Changes since v1:

  • type fixed in commit message
  • Slight changes to avoid any possible race conditions:
  • read the mic privacy state in the work function (drop the variable to store the state)
  • Cancel the mic privacy work after the interrupts are disabled on remove


/* Cancel the microphone privacy work if it is active */
if (hda->mic_privacy.active)
cancel_work_sync(&hda->mic_privacy.work);
Copy link
Collaborator

Choose a reason for hiding this comment

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

as long as the container structure is 0-initialised (e.g. allocated per kcalloc() or similar) this won't represent a bisection breakage, because the if above won't be entered, but still it's a strange split of commits - cancel work here that's initialised and submitted in the next commit... I'm just merge the two.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

as long as the container structure is 0-initialised (e.g. allocated per kcalloc() or similar) this won't represent a bisection breakage, because the if above won't be entered

Yep, this is the idea. This will not affect pre PTL platforms and PTL+ where the work is not initialized (w/o the next patch or if the mic privacy is applicable)

but still it's a strange split of commits - cancel work here that's initialised and submitted in the next commit... I'm just merge the two.

I tend to prefer separate patch for the generic 'infra' and to the platform implementing the feature, but I see your point. Let me debate this a bit, or if @ranj063, @bardliao and @kv2019i prefers a single patch than I will merge them.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I vote for separated patch

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think a single patch is preferable but not a deal-breaker for me

@ujfalusi ujfalusi force-pushed the peter/sof/pr/ptl_sdw_mic_privacy_handling_04 branch from 2fa25aa to c3c09ea Compare March 24, 2025 10:31
@ujfalusi
Copy link
Collaborator Author

Changes since v2:

  • cancel the mic privacy work in case of system suspend.
  • there is no need to do the same for runtime suspend as it is a per-requisite that all IPs have been powered down for about 3 seconds already and the mic privacy change can only sent interrupt if the soundwire is powered up.

@ujfalusi ujfalusi force-pushed the peter/sof/pr/ptl_sdw_mic_privacy_handling_04 branch from c3c09ea to 7639831 Compare March 25, 2025 07:27
… work

IPC message cannot be sent from the irq thread directly as the message will
not receive the reply (interrupts are disabled) and it will time out - the
reply is going to be received right after the we leave the irq thread.
This is a different case compared to the delayed IPC messages due to DSP
busy state.

Add support for sending the mic privacy change notification to the firmware
from a work instead of the process callback.

The work needs to be canceled if there is a chance that it might be running
on module remove or before system/runtime suspend.

Fixes: 4a43c32 ("ASoC: SOF: Intel: ptl: Add support for mic privacy")
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
@ujfalusi
Copy link
Collaborator Author

Changes since v3:

  • squash the two patch into one, update the commit message accordingly
  • cancel the mic provacy work before runtime suspend as well (it turns out the the link is not powered down earlier)

Copy link
Member

@lgirdwood lgirdwood left a comment

Choose a reason for hiding this comment

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

Is this a "fix" patch i.e. do we need it back ported to certain kernels ?

@ujfalusi
Copy link
Collaborator Author

Is this a "fix" patch i.e. do we need it back ported to certain kernels ?

The feature is heading for 6.15, I will need to send this patch asap to the current cycle.

@ranj063 ranj063 merged commit c445516 into thesofproject:topic/sof-dev Mar 27, 2025
10 of 16 checks passed
@ujfalusi ujfalusi deleted the peter/sof/pr/ptl_sdw_mic_privacy_handling_04 branch May 19, 2025 08:50
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.

6 participants