diff mbox series

[06/12] ASoC: Intel: avs: Block IPC channel on suspend

Message ID 20220707124153.1858249-7-cezary.rojewski@intel.com (mailing list archive)
State Accepted
Commit daa36bbcd78bca24db84e273bcafec9a8f81c767
Headers show
Series ASoC: Intel: avs: Updates and cleanups | expand

Commit Message

Cezary Rojewski July 7, 2022, 12:41 p.m. UTC
To allow for driver's filesystem interfaces e.g.: debugfs, to be touched
even when the device is asleep, mark IPC-channel as blocked when the
device is suspended. This causes any invocation of said interfaces that
do not toggle PM themselves to gracefully fail with "Operation not
permitted" message.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
 sound/soc/intel/avs/core.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Mark Brown July 8, 2022, 5:28 p.m. UTC | #1
On Thu, Jul 07, 2022 at 02:41:47PM +0200, Cezary Rojewski wrote:

>  		return AVS_IPC_RET(ret);
>  	}
>  
> +	avs_ipc_block(adev->ipc);
>  	avs_dsp_op(adev, int_control, false);
>  	snd_hdac_ext_bus_ppcap_int_enable(bus, false);

The fact that there's no matching change to unblock is fine since
there's already code the paths starting the DSP which does that.
Cezary Rojewski July 9, 2022, 8:29 a.m. UTC | #2
On 2022-07-08 7:28 PM, Mark Brown wrote:
> On Thu, Jul 07, 2022 at 02:41:47PM +0200, Cezary Rojewski wrote:
> 
>>   		return AVS_IPC_RET(ret);
>>   	}
>>   
>> +	avs_ipc_block(adev->ipc);
>>   	avs_dsp_op(adev, int_control, false);
>>   	snd_hdac_ext_bus_ppcap_int_enable(bus, false);
> 
> The fact that there's no matching change to unblock is fine since
> there's already code the paths starting the DSP which does that.

True. While it may be questioned why this line wasn't here from the get 
go, in practice it was redundant - nothing was ever "asking" driver for 
anything while it was asleep.

One of the next series in line is debugfs-related one. We could either 
have every single file do PM manipulation on its own or allow for fileop 
to fail gracefully if the device was asleep. Lately we revisited the 
subject and decided to move away from the first option - not every 
fileop will be resuming the device.


Regards,
Czarek
diff mbox series

Patch

diff --git a/sound/soc/intel/avs/core.c b/sound/soc/intel/avs/core.c
index 664f87c33e9d..4234adeb3d1c 100644
--- a/sound/soc/intel/avs/core.c
+++ b/sound/soc/intel/avs/core.c
@@ -556,6 +556,7 @@  static int __maybe_unused avs_suspend_common(struct avs_dev *adev)
 		return AVS_IPC_RET(ret);
 	}
 
+	avs_ipc_block(adev->ipc);
 	avs_dsp_op(adev, int_control, false);
 	snd_hdac_ext_bus_ppcap_int_enable(bus, false);