Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions sound/soc/apple/aop_audio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ impl fmt::Debug for U32 {

const EPIC_SUBTYPE_WRAPPED_CALL: u16 = 0x20;
const CALLTYPE_AUDIO_ATTACH_DEVICE: u32 = 0xc3000002;
/// kIOReturnBusy: the firmware keeps an attachment for its lifetime, so a reload sees this.
const AUDIO_RET_BUSY: u32 = 0xe00002d5;
const CALLTYPE_AUDIO_SET_PROP: u32 = 0xc3000005;
const DECIM_NUM_COEFFS: usize = 120;
const DECIM_NUM_COEFFS_HF: usize = 1023;
Expand Down Expand Up @@ -697,9 +699,14 @@ impl SndSocAopData {
}
Ok(())
}
/// A device the firmware still holds from before a module reload counts as attached.
fn audio_attach_device(&self, dev_id: u32) -> Result<()> {
let msg = AudioAttachDevice::new(dev_id);
let ret = self.epic_wrapped_call(&msg)?;
if ret == AUDIO_RET_BUSY {
dev_dbg!(self.dev, "device {:#x} still attached\n", dev_id);
return Ok(());
}
if ret != 0 {
dev_err!(
self.dev,
Expand Down
5 changes: 2 additions & 3 deletions sound/soc/apple/aop_spkr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ use kernel::{
};

use super::{
AudioAttachDevice, AudioSetDeviceProp, PowerSetting, SndSocAopData, EPIC_SUBTYPE_WRAPPED_CALL,
AudioAttachDevice, AudioSetDeviceProp, PowerSetting, SndSocAopData, AUDIO_RET_BUSY,
EPIC_SUBTYPE_WRAPPED_CALL,
};

const CALLTYPE_AUDIO_GET_PROP: u32 = 0xc3000004;
Expand All @@ -93,8 +94,6 @@ const STATE_PWRD: u32 = from_fourcc(b"pwrd");
const PWRD_OUTPUT: u32 = 2;
/// The same for an input stream (the microphones' `pwrd` request uses 1).
const PWRD_INPUT: u32 = 1;
/// kIOReturnBusy: the firmware keeps an attachment for its lifetime, so a reload sees this.
const AUDIO_RET_BUSY: u32 = 0xe00002d5;

/// Property read (0xc3000004): the same header as the property write, with a trailing 1.
#[repr(C, packed(4))]
Expand Down