• Joshua Grisham's avatar
    ALSA: hda/realtek: Refactor and simplify Samsung Galaxy Book init · 7e4d4b32
    Joshua Grisham authored
    I have done a lot of analysis for these type of devices and collaborated
    quite a bit with Nick Weihs (author of the first patch submitted for this
    including adding samsung_helper.c). More information can be found in the
    issue on Github [1] including additional rationale and testing.
    
    The existing implementation includes a large number of equalizer coef
    values that are not necessary to actually init and enable the speaker
    amps, as well as create a somewhat worse sound profile. Users have
    reported "muffled" or "muddy" sound; more information about this including
    my analysis of the differences can be found in the linked Github issue.
    
    This patch refactors the "v2" version of ALC298_FIXUP_SAMSUNG_AMP to a much
    simpler implementation which removes the new samsung_helper.c, reuses more
    of the existing patch_realtek.c, and sends significantly fewer unnecessary
    coef values (including removing all of these EQ-specific coef values).
    
    A pcm_playback_hook is used to dynamically enable and disable the speaker
    amps only when there will be audio playback; this is to match the behavior
    of how the driver for these devices is working in Windows, and is
    suspected but not yet tested or confirmed to help with power consumption.
    
    Support for models with 2 speaker amps vs 4 speaker amps is controlled by
    a specific quirk name for both types. A new int num_speaker_amps has been
    added to alc_spec so that the hooks can know how many speaker amps to
    enable or disable. This design was chosen to limit the number of places
    that subsystem ids will need to be maintained: like this, they can be
    maintained only once in the quirk table and there will not be another
    separate list of subsystem ids to maintain elsewhere in the code.
    
    Also updated the quirk name from ALC298_FIXUP_SAMSUNG_AMP2 to
    ALC298_FIXUP_SAMSUNG_AMP_V2_.. as this is not a quirk for "Amp #2" on
    ALC298 but is instead a different version of how to handle it.
    
    More devices have been added (see Github issue for testing confirmation),
    as well as a small cleanup to existing names.
    
    [1]: https://github.com/thesofproject/linux/issues/4055#issuecomment-2323411911Signed-off-by: default avatarJoshua Grisham <josh@joshuagrisham.com>
    Link: https://patch.msgid.link/20240909193000.838815-1-josh@joshuagrisham.comSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
    7e4d4b32
patch_realtek.c 431 KB