Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Microphones via AOP (+ a few SEP bits). #342

Closed

Conversation

WhatAmISupposedToPutHere
Copy link

@WhatAmISupposedToPutHere WhatAmISupposedToPutHere commented Nov 9, 2024

This adds the AOP driver, microphone support, lid angle sensor driver, and ambient light sensor driver (disabled pending some m1n1 work). Also contains just enough of a SEP driver to unlock SECDIS on base m1.

Obsoletes #151

Draft, since the mic output is basically useless without correct userspace configs (coming soontm).

@WhatAmISupposedToPutHere WhatAmISupposedToPutHere changed the title Microphones via AOP. Microphones via AOP (+ a few SEP bits). Nov 10, 2024
asahilina and others added 23 commits November 19, 2024 20:09
The missing SAFETY comments should be fixed later...

Signed-off-by: Asahi Lina <[email protected]>
The missing SAFETY comments should be fixed later...

Signed-off-by: Asahi Lina <[email protected]>
Computed based on the PAGE_SHIFT macro from C.

// Co-authored-by: Adam Bratschi-Kaye <[email protected]>
// Co-authored-by: Miguel Ojeda <[email protected]>
// Signed-off-by: Asahi Lina <[email protected]>
This is the same behavior as kstrtol/kstrtoul, and allows simple
`echo 0 > /sys/module/foo/parameters/bar` commands to work.

Signed-off-by: Asahi Lina <[email protected]>
The missing SAFETY comments should be fixed later...

Signed-off-by: Asahi Lina <[email protected]>
This abstraction enables Rust drivers to walk Device Tree nodes and
query their properties.

Signed-off-by: Asahi Lina <[email protected]>
Signed-off-by: Hector Martin <[email protected]>
Signed-off-by: Janne Grunau <[email protected]>
This patch adds a logic similar to `devm_platform_ioremap_resource`
function adding:
  - `IoResource` enumerated type that groups the `IORESOURCE_*` macros.
  - `get_resource()` method that is a binding of `platform_get_resource`
  - `ioremap_resource` that is newly written method similar to
    `devm_platform_ioremap_resource`.

Lina: Removed `bit` dependency and rebased

Co-developed-by: Asahi Lina <[email protected]>
Signed-off-by: Maciej Falkowski <[email protected]>
Allows drivers to configure the DMA masks for a device. Implemented
here, not in device, because it requires a mutable platform device
reference this way (device::Device is a safely clonable reference).

Signed-off-by: Asahi Lina <[email protected]>
Apple SoCs require non-posted mappings for MMIO, and this is
automatically handled by devm_ioremap_resource() and friends via a
resource flag. Implement the same logic in kernel::io_mem, so it can
work the same way.

Signed-off-by: Asahi Lina <[email protected]>
The AOP co-processor present on certain Apple SoCs exposes
various environmental sensors as "HID" (really not) devices.
Add drivers for the ambient light and lid angle sensors
exposed that way.

Signed-off-by: Sasha Finkelstein <[email protected]>
This is a co-processor in charge of various security-related
features on Apple SoCs. This driver only boots the firmware,
which is needed to unlock the mic secure disable on certain
laptop models.

Signed-off-by: Sasha Finkelstein <[email protected]>
@jannau
Copy link
Member

jannau commented Nov 24, 2024

I've merged everything except the device tree changes into bits/ branches. Most of it into bits/190-rust and bits/250-aop but fixups in there respective bits/* branches. I'm not happy with the split-up as merging bits/250-aop needs manual conflict resolution. I can't think of anything better though. Will get easier when we upstream more changes.

I did some minimal fixups. Can you please send 85e9396 ("dmaengine: apple-admac: Avoid accessing registers in probe") (without the compatible addition) as soon as possible. If I remember correctly special power sequencing requirements do not warrant a different compatible. If we fix upstream now we can upstream aop-admac with the same compatible string later. Downstream we will keep "apple,admac2" for now.

For commit b63a090 ("rust: Only export module id tables if building as module") please reply to https://lore.kernel.org/rust-for-linux/[email protected]/

@jannau jannau force-pushed the asahi-wip branch 5 times, most recently from 045ef5e to d21bcc2 Compare November 30, 2024 22:46
@jannau jannau force-pushed the asahi-wip branch 2 times, most recently from 5f5bf6e to fce34c8 Compare December 11, 2024 23:06
@clintaire
Copy link

Can the necessary configurations for snd_card fields be abstracted into a reusable module or script to avoid repetitive work and standardize the approach across different hardware?

@WhatAmISupposedToPutHere
Copy link
Author

Can the necessary configurations for snd_card fields be abstracted into a reusable module or script to avoid repetitive work and standardize the approach across different hardware?

Sorry i am not quite sure i understand. Are you asking as to whether there will be rust bindings for alsa? If so - yes, eventually, and those may or may not come from me.

@rosvall
Copy link

rosvall commented Dec 26, 2024

Draft, since the mic output is basically useless without correct userspace configs (coming soontm).

I've played a with this for a bit, and at least on my m1 macbook air, the sound is absolutely usable!

Here's a short 3 channel recording: mic_test_j313.wav.zip

Please merge the devicetree bindings and let people have some fun with it.

@WhatAmISupposedToPutHere
Copy link
Author

Draft, since the mic output is basically useless without correct userspace configs (coming soontm).

I've played a with this for a bit, and at least on my m1 macbook air, the sound is absolutely usable!

Here's a short 3 channel recording: mic_test_j313.wav.zip

Please merge the devicetree bindings and let people have some fun with it.

How much did you boost the signal?

@rosvall
Copy link

rosvall commented Dec 26, 2024

Draft, since the mic output is basically useless without correct userspace configs (coming soontm).

I've played a with this for a bit, and at least on my m1 macbook air, the sound is absolutely usable!
Here's a short 3 channel recording: mic_test_j313.wav.zip
Please merge the devicetree bindings and let people have some fun with it.

How much did you boost the signal?

It's not boosted. I've just set configuration profile to "Pro Audio" and gain to 0dB in pavucontrol, and recorded with arecord -D pipewire -d 10 -r 48000 -v -f FLOAT_LE -c 3 mic_test_j313.wav

@WhatAmISupposedToPutHere
Copy link
Author

Draft, since the mic output is basically useless without correct userspace configs (coming soontm).

I've played a with this for a bit, and at least on my m1 macbook air, the sound is absolutely usable!
Here's a short 3 channel recording: mic_test_j313.wav.zip
Please merge the devicetree bindings and let people have some fun with it.

How much did you boost the signal?

It's not boosted. I've just set configuration profile to "Pro Audio" and gain to 0dB in pavucontrol, and recorded with arecord -D pipewire -d 10 -r 48000 -v -f FLOAT_LE -c 3 mic_test_j313.wav

Well, this is not how it works on, say j314, where a boost of 50-ish dba is required for the signal to be audible.

@rosvall
Copy link

rosvall commented Dec 26, 2024

Well, this is not how it works on, say j314, where a boost of 50-ish dba is required for the signal to be audible.

Is it broken on every j314?

@WhatAmISupposedToPutHere
Copy link
Author

Well, this is not how it works on, say j314, where a boost of 50-ish dba is required for the signal to be audible.

Is it broken on every j314?

At least two of them. j415 also needs 20-30 dba of boost.

@chadmed
Copy link

chadmed commented Dec 26, 2024

That mic signal is useless and almost silent. J313 will need boosting too.

@jannau
Copy link
Member

jannau commented Jan 3, 2025

device nodes (disabled) included in asahi-6.12.8-1, going to close this PR
trivial patches to enable the mics are in https://github.com/jannau/linux/commits/mics-asahi-6.12.8-1/

changes compared to this PR:

  • enable mics on M1 imacs
  • enable sep only on t8103-j*

@jannau jannau closed this Jan 3, 2025
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.

9 participants