]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ASoC: rt5677: fix SPI dependency
authorArnd Bergmann <arnd@arndb.de>
Wed, 28 Jan 2015 21:31:30 +0000 (22:31 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 6 Mar 2015 22:57:18 +0000 (14:57 -0800)
commit 4c121129c9dcb43b33d1cd568c8f2636e72597b0 upstream.

The rt5677 codec has gained code that requires SPI to work correctly,
but there is no provision in Kconfig to prevent the driver from
being used when SPI is disabled or a loadable module, resulting
in this build error:

sound/built-in.o: In function `rt5677_spi_write':
:(.text+0xa7ba0): undefined reference to `spi_sync'
sound/built-in.o: In function `rt5677_spi_driver_init':
:(.init.text+0x253c): undefined reference to `spi_register_driver'

ERROR: "spi_sync" [sound/soc/codecs/snd-soc-rt5677-spi.ko] undefined!
ERROR: "spi_register_driver" [sound/soc/codecs/snd-soc-rt5677-spi.ko] undefined!

This makes the SPI portion of the driver depend on the SPI subsystem,
and disables the function that uses SPI for firmware download if SPI
is disabled. The latter may not be the correct solution, but I could
not come up with a better one.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: af48f1d08a54741 ("ASoC: rt5677: Support DSP function for VAD application")
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
sound/soc/codecs/Kconfig
sound/soc/codecs/rt5677.c

index 8349f982a586841a3ac9e7b0526af05699c7deaf..ef2c70e77d918149b7f65c5d4f74e744e1600159 100644 (file)
@@ -525,7 +525,7 @@ config SND_SOC_RT5677
 
 config SND_SOC_RT5677_SPI
        tristate
-       default SND_SOC_RT5677
+       default SND_SOC_RT5677 && SPI
 
 #Freescale sgtl5000 codec
 config SND_SOC_SGTL5000
index 918ada9738b0431e9d47d0dc5155cd42d9e2fb2a..cc9098830ed80434375e1f8b89117cddf454e339 100644 (file)
@@ -702,6 +702,9 @@ static int rt5677_set_dsp_vad(struct snd_soc_codec *codec, bool on)
        static bool activity;
        int ret;
 
+       if (!IS_ENABLED(CONFIG_SND_SOC_RT5677_SPI))
+               return -ENXIO;
+
        if (on && !activity) {
                activity = true;