mbox series

[v4,00/10] ASoC: mediatek: mt8183-mt6358-ts3a227-max98357: support WoV

Message ID 20191017213539.00-tzungbi@google.com
Headers show
Series ASoC: mediatek: mt8183-mt6358-ts3a227-max98357: support WoV | expand

Message

Tzung-Bi Shih Oct. 17, 2019, 2 p.m. UTC
This series makes mt6358, cros_ec_codec, and mt8183-mt6358-ts3a227-max98357
support WoV (wake on voice).

The first 3 commits are some cleanups and refactors.  It looks like
breaking the existing interface.  But please be noticed that, the
cros_ec_codec has not used by any real device yet.  The refactor is
very necessary to keep the style consistent and for easier to further
extend and maintain.
  platform/chrome: cros_ec: remove unused EC feature
  ASoC: cros_ec_codec: refactor I2S RX
  ASoC: cros_ec_codec: extract DMIC EC command from I2S RX

The 4th commit extends the feature offered from EC codec.
  platform/chrome: cros_ec: add common commands for EC codec

The 5th commit changes the behavior of setting and getting DMIC gains.
  ASoC: cros_ec_codec: read max DMIC gain from EC codec

The 6th and 7th commit make cros_ec_codec support WoV.
  ASoC: dt-bindings: cros_ec_codec: add SHM bindings
  ASoC: cros_ec_codec: support WoV

The 8th commit sets necessary registers on mt6358 to support WoV.
  ASoC: mediatek: mt6358: support WoV

The last 2 commit make machine driver mt8183-mt6358-ts3a227-max98357
support WoV if ec-codec is in DTS.
  ASoC: dt-bindings: mt8183: add ec-codec
  ASoC: mediatek: mt8183: support WoV

Changes from v3:
- fix a compile error by adding ifdef
https://mailman.alsa-project.org/pipermail/alsa-devel/2019-October/156750.html
- fix a coccinelle warning
https://mailman.alsa-project.org/pipermail/alsa-devel/2019-October/156754.html

Changes from v2:
- rebase upon to "don't use snd_pcm_ops" series
https://mailman.alsa-project.org/pipermail/alsa-devel/2019-October/156170.html
- fix sparse errors
https://mailman.alsa-project.org/pipermail/alsa-devel/2019-October/156328.html
- use "reg" for SHM binding
https://mailman.alsa-project.org/pipermail/alsa-devel/2019-October/156657.html

Changes from v1:
- fix a compile error and make kbuild bot happy
https://mailman.alsa-project.org/pipermail/alsa-devel/2019-October/156315.html

Tzung-Bi Shih (10):
  platform/chrome: cros_ec: remove unused EC feature
  ASoC: cros_ec_codec: refactor I2S RX
  ASoC: cros_ec_codec: extract DMIC EC command from I2S RX
  platform/chrome: cros_ec: add common commands for EC codec
  ASoC: cros_ec_codec: read max DMIC gain from EC codec
  ASoC: dt-bindings: cros_ec_codec: add SHM bindings
  ASoC: cros_ec_codec: support WoV
  ASoC: mediatek: mt6358: support WoV
  ASoC: dt-bindings: mt8183: add ec-codec
  ASoC: mediatek: mt8183: support WoV

 .../bindings/sound/google,cros-ec-codec.txt   |   24 +-
 .../sound/mt8183-mt6358-ts3a227-max98357.txt  |    3 +
 drivers/platform/chrome/cros_ec_trace.c       |    5 +-
 .../linux/platform_data/cros_ec_commands.h    |  285 ++++-
 sound/soc/codecs/cros_ec_codec.c              | 1128 +++++++++++++----
 sound/soc/codecs/mt6358.c                     |  105 ++
 sound/soc/mediatek/Kconfig                    |    1 +
 .../mt8183/mt8183-mt6358-ts3a227-max98357.c   |   70 +-
 8 files changed, 1296 insertions(+), 325 deletions(-)

Comments

Mark Brown Oct. 18, 2019, 5:22 p.m. UTC | #1
On Thu, Oct 17, 2019 at 10:00:12PM +0800, Tzung-Bi Shih wrote:
> 1. Get EC codec's capabilities.
> 2. Get and set SHM address if any.
> 3. Transmit language model to EC codec if needed.
> 4. Start to read audio data from EC codec if receives host event.

This breaks the build:

ld: sound/soc/codecs/cros_ec_codec.o: in function `calculate_sha256.isra.15':
cros_ec_codec.c:(.text+0x119d): undefined reference to `crypto_alloc_shash'
ld: cros_ec_codec.c:(.text+0x11c1): undefined reference to `crypto_shash_digest'
ld: cros_ec_codec.c:(.text+0x11df): undefined reference to `crypto_destroy_tfm'
make: *** [Makefile:1094: vmlinux] Error 1
Tzung-Bi Shih Oct. 18, 2019, 6:39 p.m. UTC | #2
On Sat, Oct 19, 2019 at 1:22 AM Mark Brown <broonie@kernel.org> wrote:
>
> On Thu, Oct 17, 2019 at 10:00:12PM +0800, Tzung-Bi Shih wrote:
> > 1. Get EC codec's capabilities.
> > 2. Get and set SHM address if any.
> > 3. Transmit language model to EC codec if needed.
> > 4. Start to read audio data from EC codec if receives host event.
>
> This breaks the build:
>
> ld: sound/soc/codecs/cros_ec_codec.o: in function `calculate_sha256.isra.15':
> cros_ec_codec.c:(.text+0x119d): undefined reference to `crypto_alloc_shash'
> ld: cros_ec_codec.c:(.text+0x11c1): undefined reference to `crypto_shash_digest'
> ld: cros_ec_codec.c:(.text+0x11df): undefined reference to `crypto_destroy_tfm'
> make: *** [Makefile:1094: vmlinux] Error 1

Thanks so much for pointing this out.  Yeah, I forgot to select
CRYPTO_SHA256 in Kconfig.

Looks like there is a blind point in my local build tests
(allyesconfig, allnoconfig, allmodconfig).  The config in the build
fail case could be "CROS_EC_CODEC=y" and "CRYPTO_*=n".

Could you tell me how you get the .config (to enhance my local build
tests next time)?  I tried randconfig several times but it seems not
easy to hit the case (i.e. CROS_EC_CODEC=y but CRYPTO_*=n).
Mark Brown Oct. 18, 2019, 6:42 p.m. UTC | #3
On Sat, Oct 19, 2019 at 02:39:20AM +0800, Tzung-Bi Shih wrote:

> Could you tell me how you get the .config (to enhance my local build
> tests next time)?  I tried randconfig several times but it seems not
> easy to hit the case (i.e. CROS_EC_CODEC=y but CRYPTO_*=n).

That one was caught using merge_config.sh to merge in the config below
then have a script that turns on all options in my subsystems and MFD.

CONFIG_COMPILE_TEST=y
CONFIG_OF=y
CONFIG_I2C=y
CONFIG_SPI=y
CONFIG_REGULATOR=y
CONFIG_SOUND=y
CONFIG_SND=y
CONFIG_SND_SOC=y
CONFIG_SND_SOC_ALL_CODECS=y
CONFIG_SPMI=y
CONFIG_NLS=y
CONFIG_SLIMBUS=y
CONFIG_CLK=y
CONFIG_DMADEVICES=y
CONFIG_PCI=y
CONFIG_ACPI=y