• Trevor Wu's avatar
    ASoC: mediatek: common: revise SOF common code · 4047b35c
    Trevor Wu authored
    Originally, normal dai link fixup callback is overwritten by sof fixup
    callback on mtk_sof_card_late_probe and it relies on the mapping defined
    on struct sof_conn_stream.
    
    It's not flexible. When a new hardware connection is adopted, user needs
    to update struct sof_conn_stream defined in machine driver which is used
    to specify the mapping relationship of normal BE and SOF BE.
    
    In the patch, mtk_sof_check_tplg_be_dai_link_fixup() is introduced for
    all normal BEs. In mtk_sof_late_probe, back up normal BE fixup if it
    exists and then overwrite be_hw_params_fixup by the new callback.
    
    There are two cases for FE and BE connection.
    
    case 1:
    SOF FE -> normal BE
           -> SOF_BE
    
    case 2:
    normal FE -> normal BE
    
    In the new fixup callback, it tries to find SOF_BE which connects to the
    same FE, and then reuses the fixup of SOF_BE. If no SOF_BE exists,
    it must be case 2, so rollback to the original fixup if it exists.
    
    As a result, the predefined relation is not needed anymore. Hardware
    connection can be controlled by the mixer control for AFE interconn.
    Then, DPCM finds the BE mapping at runtime.
    Signed-off-by: default avatarTrevor Wu <trevor.wu@mediatek.com>
    Reviewed-by: default avatarAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
    Link: https://lore.kernel.org/r/20230825024935.10878-3-trevor.wu@mediatek.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
    4047b35c
mtk-dsp-sof-common.h 1.16 KB