Commit graph

89 commits

Author SHA1 Message Date
James Calligeros
8ff0db2e96
readme: fix typo
Signed-off-by: James Calligeros <jcalligeros99@gmail.com>
2023-12-19 22:11:54 +10:00
James Calligeros
f171b10df0
update README
Signed-off-by: James Calligeros <jcalligeros99@gmail.com>
2023-12-19 22:08:40 +10:00
Hector Martin
045dbfb5b5 Bump to 0.1.9
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-12-17 19:45:19 +09:00
Hector Martin
813c6c2443 j314: Manually tweak model
Apple seems to have gotten this one wrong too :/

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-12-17 19:45:19 +09:00
Hector Martin
8f4ed7abec j413: Manually tweak tweeter model
Apple seems to have screwed this one up, judging by running test
tones...

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-12-17 18:41:56 +09:00
Hector Martin
4b24e782e0 Bump to 0.1.8
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-12-17 17:14:36 +09:00
Hector Martin
ea4a8e9d35 main: Work around visense kernel channel swap bug
This is ugly and we really should figure out why the kernel admac stuff
borks, but it'll do for now...

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-12-17 17:14:36 +09:00
Hector Martin
4bbda81f68 analyze.py: Update gains for new kernel config
Also show the impedance in stdout.

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-12-17 17:14:36 +09:00
Andreas Henriksson
d77bdd7bc2 Install tmpfiles.d snippet to create blackbox
Create the variable content as needed instead of simply relying on
statically shipping it at initial install.
This is better aligned with the concepts of stateless systems, factory
reset, ostree, etc.

Signed-off-by: Andreas Henriksson <andreas@fatal.se>
2023-12-12 21:19:55 +10:00
Andreas Henriksson
71b9c84f99 Fix blackbox install path
The service file already uses the correct path,
so lets create the directory at the right path as well.

Fixes: #3
Signed-off-by: Andreas Henriksson <andreas@fatal.se>
2023-12-12 21:19:55 +10:00
Hector Martin
223d206fee speakers.txt: Correct gain for j375
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-12-11 22:27:18 +09:00
Hector Martin
035c02ca6a Bump to 0.1.7
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-12-11 22:19:06 +09:00
Andreas Henriksson
f069160e33 build: split install and install-data targets
This allows only installing the data files in case the build is done
separately (like for example when using debcargo/dh-cargo which uses
rustc --target option and thus the speakersafetyd ends up in a different
path which includes the target).

While at it also mark all targets as PHONY, since none of them are
backed by an actual file with the same name.

Signed-off-by: Andreas Henriksson <andreas@fatal.se>
2023-12-11 21:57:40 +10:00
Janne Grunau
0e5fa0921f conf: j493: Fix volume control name
The M2 based Macbook Pro 13-inch uses tas2764 as speaker amp which uses
a different volume control name compared to j293.

Signed-off-by: Janne Grunau <j@jannau.net>
2023-12-11 21:52:51 +10:00
Janne Grunau
bc1e4daf19 conf: j375,j473,j474,j475: Fix volume control name
Use j375 as base for Mac mini/studio devices with tas2764 speaker amp.
The volume control has a different name compared to j274.

Signed-off-by: Janne Grunau <j@jannau.net>
2023-12-11 21:52:51 +10:00
Hector Martin
33797aee2d Bump to 0.1.6
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-12-08 23:22:39 +09:00
Hector Martin
9cfcedd469 rules: Enable all the devices expected to work soon
This is still kernel-gated.

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-12-08 23:20:24 +09:00
Hector Martin
1352408b54 Add testing scripts
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-12-08 23:19:19 +09:00
Hector Martin
88acee7517 conf, audump: Add tempcos to speakers
We only have real values for spp3 machines, so everything else gets a
default.

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-12-08 18:46:04 +09:00
Hector Martin
a901278264 Cargo.toml: Upgrade configparser and enable indexmap
We need this to keep speaker order stable for blackbox dumps to have
meaning.

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-12-07 20:06:13 +09:00
Hector Martin
38bc94fa77 blackbox: Fix metadata dump iteration
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-12-07 17:56:27 +09:00
Hector Martin
1773c6425b main: Handle SIGQUIT even if we got samples
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-12-07 17:11:07 +09:00
Hector Martin
2c7fd76cec rules: Remove compat rule
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-12-04 23:24:07 +09:00
Hector Martin
8fed89e8e5 Bump to 0.1.5
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-12-04 22:55:23 +09:00
Hector Martin
d42f4817e0 cargo fmt
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-12-04 18:41:02 +09:00
Hector Martin
c3307388aa uclamp: Add support for sched utilization clamping
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-12-04 18:40:46 +09:00
Hector Martin
60752494cd main: Trap SIGQUIT to trigger a blackbox
The signal_hook crate makes this easy, but unfortunately insists on
hardcoding SA_RESTART. So we have to then use libc directly to patch
that out...

Still worth using signal_hook for the atomic flag helper though.

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-12-04 18:40:46 +09:00
Hector Martin
4fb7fe7b41 main, rules: Rename Jxxx to AppleJxxx
This makes it more clear that we're matching against Apple machines. The
kernel driver will be updated to use this naming scheme. For backwards
compatibility, we add a rule to rename J313 at runtime (the only enabled
model at this time).

This update must be released together with a matching asahi-audio update
(but the kernel can come later).

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-12-04 17:24:31 +09:00
James Calligeros
38e5b9f4c4
conf: apple: j415: fix typo
Signed-off-by: James Calligeros <jcalligeros99@gmail.com>
2023-11-25 14:21:06 +10:00
Hector Martin
d1c1f0b5b9 Bump to 0.1.4
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-10-30 19:00:58 +09:00
Hector Martin
d1e71ce74f udev: Enable j313
First model for testing deployment

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-10-30 19:00:20 +09:00
Hector Martin
95f01fd5fd LICENSE: Remove year from copyright line
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-10-30 18:59:41 +09:00
Hector Martin
a769d555e5 Add Makefile
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-10-30 18:59:01 +09:00
Hector Martin
b1f65f5971 udev: Add all models, comment out autolaunch
To be uncommented piecewise as we validate models

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-10-30 16:01:14 +09:00
Hector Martin
7a82648d59 types: Display rounded-to-0 gain
So the display goes directly to 0.00 instead of flickering -0.00.

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-10-29 00:35:39 +09:00
Hector Martin
ac120b7be1 types: Test for negative powers
Disallow nontrivial negative power, but clamp down rounding error to
avoid flickering signs in debug logs.

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-10-29 00:35:39 +09:00
Hector Martin
21023ec426 Change temperature handling
Headroom goes *above* the limit, not below. Replace the max safe temp
thing with a window delta below the limit where attenuation begins.

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-10-29 00:35:39 +09:00
Hector Martin
b12c8b69da main: Handle partial reads
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-10-29 00:30:35 +09:00
Hector Martin
e2b3a3ba7f main: Verbosely log suspend/resume handling
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-10-29 00:30:35 +09:00
Hector Martin
dd568f1391 speakersafetyd.service: Enable blackbox & conservative threshold
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-10-29 00:29:23 +09:00
Hector Martin
f8d9c55cbb types: Always set amp gain to max on startup
The kernel should clamp this to the correct value. We still read it back
later, to make sure our amp output calculations are correct.

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-10-29 00:29:23 +09:00
Hector Martin
071830b040 conf: Add missing configs & update
Mostly autogenerated from macOS AU preset dumps, with speaker names and
channel orders manually adjusted as necessary.

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-10-29 00:29:23 +09:00
Hector Martin
a133e419b0 docs: Add audump.py and speakers.txt
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-10-29 00:29:23 +09:00
Hector Martin
91e7c14b8e types: Do not prefix speaker name "Mono"
For single-speaker devices, there is no control prefix. So treat the
special name "Mono" as a null prefix in that case.

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-10-29 00:29:23 +09:00
Hector Martin
83a53ba99f blackbox: Change file extensions
I guess I'm watching too much Mentour Pilot these days :-)

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-10-29 00:29:23 +09:00
Hector Martin
315255a7e0 main: Log blackbox speaker groups in integer order
For consistency.

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-10-29 00:29:23 +09:00
Hector Martin
368be9d7df blackbox: Store state for all blocks
This lets us validate the model from blackbox dumps.

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-10-29 00:29:22 +09:00
Hector Martin
7fbb53df51 blackbox: Add black-box debug functionality
On any panic, we dump out the last ~30 seconds of IVSENSE data along
with the starting state and panic reason.

Also add a feature to panic if the gain reduces too much. This can be
used to try to catch badness.

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-10-29 00:28:08 +09:00
Hector Martin
a476f7daf1 helpers, types: Switch to panic for errors
We're not doing explicit error handling, since the kernel is in charge
of safety if we crash. Just panic on anything.

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-10-23 02:20:19 +09:00
Hector Martin
157ddc4e41 Add suspend handling
ALSA needs special handling to correctly resume after the system is
suspended with a PCM active. Do the required dance.

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-10-22 09:03:12 +09:00