#asahi-dev · 2022-09-12 14:00
marcanDmitrySharshakov[m]: random example: my phone does it with a codec that has an actual DSP and firmware: https://github.com/LineageOS/android_device_google_bramble/tree/lineage-19.1/audio/cs35l41#asahi-dev · 2022-09-12 13:55
marcanthey rely on userspace for everything on Android#asahi-dev · 2022-09-12 13:55
marcancase in point: at one point LineageOS for one of my older phones had the vibrator gain set too high, and it would rattle like hell#asahi-dev · 2022-09-12 13:55
marcanI doubt most Android platforms implement proper safeties in the kernel, they just rely on the userspace config being correct#asahi-dev · 2022-09-12 13:54
marcanyes#asahi-dev · 2022-09-12 13:53
marcanour requirements are not the same for desktop linux#asahi-dev · 2022-09-12 13:53
marcanwith platforms like that, the platform can assume userspace is doing the "right" thing#asahi-dev · 2022-09-12 13:53
marcanwhich is why I blew my Chromebook speakers when I poked around alsamixer#asahi-dev · 2022-09-12 13:53
marcansame as Chrome OS#asahi-dev · 2022-09-12 13:53
marcanthey have a different paradigm#asahi-dev · 2022-09-12 13:53
marcanDmitrySharshakov[m]: Android has a whole audio framework, and you can trust it because Android is a fixed OS built for specific machines#asahi-dev · 2022-09-12 13:52
marcanI wish these things had a couple biquads we could just program... they already do a significant amount of DSP anyway#asahi-dev · 2022-09-12 13:52
marcanlet's see if the data is even useful at all#asahi-dev · 2022-09-12 13:51
marcanbut the maximum safe volume for all possible inputs may wind up being significantly lower than what macOS achieves#asahi-dev · 2022-09-12 13:51
marcanhaving volume caps is trivial#asahi-dev · 2022-09-12 13:51
marcanDmitrySharshakov[m]: the problem is it being frequency-dependent#asahi-dev · 2022-09-12 13:50
marcanand I'll see about getting this thing repaired#asahi-dev · 2022-09-12 13:50
marcanpovik: anyway, please see if you can get the data out :)#asahi-dev · 2022-09-12 13:49
marcanand the kernel is supposed to ensure safety#asahi-dev · 2022-09-12 13:49
marcanbut the usual use case isn't safety related#asahi-dev · 2022-09-12 13:48
marcanI mean I know the usual arguments here#asahi-dev · 2022-09-12 13:48
marcanif it's just taking some envelopes and doing some simple hysteresis or whatever, I'm not sure punting that to userspace (with the additional complexity of watching over it from the kernel anyway, and having a handshake for the uncapping) actually buys you much?#asahi-dev · 2022-09-12 13:48
marcanyeah, the main thing is really how much processing does it have to do, and do you actually get anything out of it being in userspace at that point#asahi-dev · 2022-09-12 13:47
marcanm1n1 populates those properties#asahi-dev · 2022-09-12 13:47
marcanrmk: yes#asahi-dev · 2022-09-12 13:47
marcanbut at that point I'm not sure if that *really* buys you a whole lot over a kernel thread doing the same thing, so that'd be a discussion to have on the MLs#asahi-dev · 2022-09-12 13:46
marcanthen that'd need kernel checks to make sure that process is alive and processing input data, and if it stops, revert the increased volume caps#asahi-dev · 2022-09-12 13:46
marcanpovik: an alternative would be to build this as a "speakersafetyd" that both enables the higher volume caps and watches over the I/VSENSE data, and is supposed to be simple / unrelated to any sound system in use#asahi-dev · 2022-09-12 13:45
marcanI think macOS does activate it#asahi-dev · 2022-09-12 13:43
marcanI wouldn't lower the gain, I'd just mute for a second or so. this is supposed to be a last resort safety, under the assumption that userspace *is* trying to do the right thing in the normal case.#asahi-dev · 2022-09-12 13:43
marcanit's not nice but it's nicer than DSP in the kernel or requiring sane userspace#asahi-dev · 2022-09-12 13:42
marcanbut I think we might be able to do something like a partial sampling where we don't necessarily process all the data, but just do RMS measurements on part of each frame, enough to decide whether to trip a safety mute#asahi-dev · 2022-09-12 13:42
marcanno#asahi-dev · 2022-09-12 13:42
marcanit depends on what we see, so let's get the data out first#asahi-dev · 2022-09-12 13:42
marcanpovik: for safety reasons, there is an argument for doing something with the I/VSENSE data in the kernel I think, especially if the alternative is DSP in the kernel / trusting userspace#asahi-dev · 2022-09-12 13:32
marcanso maybe the trick here is to just lower the max volume of the tweeters#asahi-dev · 2022-09-12 13:32
marcanyeah, in general I think the tweeters are too loud sans EQ anyway, they actively hurt my ears#asahi-dev · 2022-09-12 13:31
marcanit's possible they seized up, and the remaining frequency that comes out is whatever the mechanical state they ended up in allows via resonance#asahi-dev · 2022-09-12 13:31
marcanas for the tweeters though, I do suspect those just cooked themselves at this volume, to some extent#asahi-dev · 2022-09-12 13:30
marcan*put out#asahi-dev · 2022-09-12 13:30
marcanbut it's still dumb to try to put put anything lower than 50Hz, you can *hear* the things moving at 20Hz even though they don't do much#asahi-dev · 2022-09-12 13:30
marcanI don't think this is what damaged the woofers though / caused the rattling, I think it's more likely that there are resonant peaks that cause things to break/get loose mechanically#asahi-dev · 2022-09-12 13:29
marcanhence, ISENSE/VSENSE might be useful here#asahi-dev · 2022-09-12 13:29
marcanyes#asahi-dev · 2022-09-12 13:29
marcanDmitrySharshakov[m]: I don't think that's true. the movement of the coils has feedback effects on voltage/current, which could increase current flow.#asahi-dev · 2022-09-12 13:07
marcanso we should probably set the HPF for the woofers to 50 Hz, I don't see the point in trying to pump out anything lower#asahi-dev · 2022-09-12 13:07
marcanas for the woofers: macOS doesn't get anything below 80Hz out of them, though it does spit out odd harmonics from inputs as low as 25 Hz, which I suspect is a deliberate saturation filter#asahi-dev · 2022-09-12 12:47
marcan:D#asahi-dev · 2022-09-12 12:47
marcanyeah?#asahi-dev · 2022-09-12 12:46
marcananyway, given all this, I'm going to make sure speakers are disabled across the board and push out testing kernels