Samsung: publish display rotation for CS35L41 speaker-rotation fix - #50
Open
bod09 wants to merge 1 commit into
Open
Samsung: publish display rotation for CS35L41 speaker-rotation fix#50bod09 wants to merge 1 commit into
bod09 wants to merge 1 commit into
Conversation
On tablets with four CS35L41 amps (Galaxy Tab S6 etc.) the stereo image is wrong in landscape because nothing re-maps the amp channel routing on rotation. Register a DisplayListener and publish the display rotation to persist.sys.phh.audio_rotation; the device-side phh-spkrot.sh helper re-maps the amps to match. No-ops on devices without those controls. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Companion to TrebleDroid/device_phh_treble#87, following the approach you suggested there.
On Samsung tablets with four Cirrus CS35L41 speaker amps (Galaxy Tab S6, etc.) all four speakers can be driven, but the stereo image is wrong in landscape: with four corner speakers a correct left/right split is by column in portrait and by row in landscape, and the vendor HAL never re-maps this on rotation (its only lever is a plain L/R mirror). I could not find a setParameters that makes the HAL re-map these speakers (the rotation it already receives only feeds the SoundBooster DSP path, which is not active under a GSI), so this uses the property fallback you described.
This change registers a DisplayListener in the Samsung startup and publishes the display rotation (Surface.ROTATION_0..3) into persist.sys.phh.audio_rotation whenever it changes, plus once at boot. The device side (the linked PR) has a small one-shot, phh-spkrot.sh, triggered by that property, which sets the four amp channel-routing controls to match. No polling and no dumpsys.
It runs for all Samsung devices; the device-side helper no-ops on anything without the CS35L41 controls, so it is harmless elsewhere. Happy to gate it more tightly (model check) if you would prefer.
Verified end to end on a Galaxy Tab S6 (SM-T860, LineageOS 23.2 GSI): all four speakers play and a left-only test tone stays on the physical left through a full turn with auto-rotate on. Note: I have not compiled treble_app locally, so a build check would be good; the code follows the existing setParameters/SystemProperties patterns in this file.