• Arnd Bergmann's avatar
    ASoC: codecs: wcd938x: fix wcd module dependency · b9a4b57f
    Arnd Bergmann authored
    With SND_SOC_ALL_CODECS=y and SND_SOC_WCD938X_SDW=m, there is a link
    error from a reverse dependency, since the built-in codec driver calls
    into the modular soundwire back-end:
    
    x86_64-linux-ld: sound/soc/codecs/wcd938x.o: in function `wcd938x_codec_free':
    wcd938x.c:(.text+0x2c0): undefined reference to `wcd938x_sdw_free'
    x86_64-linux-ld: sound/soc/codecs/wcd938x.o: in function `wcd938x_codec_hw_params':
    wcd938x.c:(.text+0x2f6): undefined reference to `wcd938x_sdw_hw_params'
    x86_64-linux-ld: sound/soc/codecs/wcd938x.o: in function `wcd938x_codec_set_sdw_stream':
    wcd938x.c:(.text+0x332): undefined reference to `wcd938x_sdw_set_sdw_stream'
    x86_64-linux-ld: sound/soc/codecs/wcd938x.o: in function `wcd938x_tx_swr_ctrl':
    wcd938x.c:(.text+0x23de): undefined reference to `wcd938x_swr_get_current_bank'
    x86_64-linux-ld: sound/soc/codecs/wcd938x.o: in function `wcd938x_bind':
    wcd938x.c:(.text+0x2579): undefined reference to `wcd938x_sdw_device_get'
    x86_64-linux-ld: wcd938x.c:(.text+0x25a1): undefined reference to `wcd938x_sdw_device_get'
    x86_64-linux-ld: wcd938x.c:(.text+0x262a): undefined reference to `__devm_regmap_init_sdw'
    
    Work around this using two small hacks: An added Kconfig dependency
    prevents the main driver from being built-in when soundwire support
    itself is a loadable module to allow calling devm_regmap_init_sdw(),
    and a Makefile trick links the wcd938x-sdw backend as built-in
    if needed to solve the dependency between the two modules.
    
    Fixes: 04544222 ("ASoC: codecs: wcd938x: add audio routing and Kconfig")
    Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
    Link: https://lore.kernel.org/r/20210721150510.1837221-1-arnd@kernel.orgSigned-off-by: default avatarMark Brown <broonie@kernel.org>
    b9a4b57f
Makefile 28.6 KB