Commit graph

60 commits

Author SHA1 Message Date
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
Hector Martin
cfde41c18e Bump to 0.1.3
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-10-15 08:41:52 +09:00
Hector Martin
063db4854b Downgrade more deps
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-10-15 08:41:34 +09:00
Hector Martin
bc318e0687 Bump to 0.1.2
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-10-15 08:35:11 +09:00
Hector Martin
b91dacb7a6 Drop unused half dependency
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-10-15 08:34:57 +09:00
Hector Martin
be47a3c050 udev: Mark sense devices as ACP_IGNORE
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-10-15 08:34:33 +09:00
Hector Martin
12ecb8c6dd Bump to 0.1.1 2023-10-14 11:12:28 +09:00
Hector Martin
1007463e60 Add udev rules
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-10-14 11:12:17 +09:00
Hector Martin
5708edf68d Cargo.toml: Add homepage 2023-10-14 10:42:00 +09:00
Hector Martin
cad5c81a68 Cargo.toml: Add missing fields
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-10-14 10:30:40 +09:00
Hector Martin
5d420dfe44 Update README 2023-10-14 10:22:05 +09:00
Hector Martin
557b74a03b Cargo.toml: Bump alsa-rs version
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-10-14 10:17:06 +09:00
Hector Martin
8fb7c31f88 Make mixer element names configurable
Doesn't really matter for us since all machines we plan to use so far
have the same chip, but might matter in the future.

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-10-14 10:15:55 +09:00
Hector Martin
7e8d634f64 Add unit file
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-10-13 15:18:54 +09:00
Hector Martin
a250a73dd6 Clean up warnings
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-10-13 13:39:34 +09:00
Hector Martin
f33417573f Move config files under apple/
Take the vendor from the DT compatible, since in principle other
manufacturers could use this code too.

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-10-13 13:36:20 +09:00
Hector Martin
c43b8b752b fixup! Implement flag file for optimistic cold boot state 2023-10-13 13:35:31 +09:00
Hector Martin
f382ce7a5c Verbosely report all gain changes
Just reporting the first nonzero change isn't really useful. Be spammy,
we can always reduce this later.

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-10-13 13:34:46 +09:00
Hector Martin
ffa5af391d Implement flag file for optimistic cold boot state
If this is the first time the daemon runs, we assume 99C (just under the
limit, which means no reduction). Otherwise, we assume the max
temperature, and therefore max limit.

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-10-13 13:34:41 +09:00
Hector Martin
910124421b conf: Add j413 config
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-10-12 17:21:14 +09:00
Hector Martin
8932696541 Move j314.conf into conf/ dir
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-10-12 17:20:57 +09:00
Hector Martin
fa4f763d05 Implement catchup/skipping the model forward
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-10-12 17:18:31 +09:00
Hector Martin
7ab0fed6d3 main: Report when gains go back to nominal
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-10-12 16:53:35 +09:00
Hector Martin
64e6710dac main: Be less spammy about sample rates
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-10-12 16:53:27 +09:00
Hector Martin
5c1fd2b60b main: Reset gains to 0dB on startup
This is mostly to avoid a sudden jump up in volume on the common case where the
first sound happens after enough catchup has occurred (once we implement
catchup...)

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-10-12 16:52:37 +09:00
Hector Martin
3660fd85d8 main: Implement main magic unlock control
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-10-12 16:52:12 +09:00
Hector Martin
6cb6c45083 types: Fix worst case initial magnet temp calculation
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-10-12 16:51:37 +09:00
Hector Martin
14c3ef0b7e types: Add write_int() helper
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-10-12 16:51:29 +09:00
Hector Martin
e19970b5e0 types: Lock all elements we interact with
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-10-12 16:51:15 +09:00
Hector Martin
7dc04ccb1d helpers: Add lock_el helper
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-10-12 16:51:00 +09:00