Logo
5.4.0-rc1
  • Linux カーネルユーザー・管理者ガイド
  • カーネルビルドシステム
  • Linux カーネルファームウェアガイド
  • Linux カーネルユーザー空間 API ガイド
  • IOCTL
  • カーネル開発コミュニティとの共同作業
  • カーネルの開発ツール
  • カーネルドキュメントの書き方
  • カーネルハックガイド
  • Linux のトレース技術
  • カーネルメンテナハンドブック
  • フォールトインジェクション
  • カーネルライブパッチ
  • Linux ドライバー実装者の API ガイド
  • コア API ドキュメント
  • ロック
  • Accounting
  • Block
  • cdrom
  • Integrated Drive Electronics (IDE)
  • Frame Buffer
  • fpga
  • Human Interface Devices (HID)
  • I2C/SMBus サブシステム
  • Industrial I/O
  • ISDN
  • InfiniBand
  • LEDs
  • Linux メディアサブシステムドキュメント
  • NetLabel
  • Linux ネットワークドキュメント
  • pcmcia
  • 電源管理
  • TCM Virtual Device
  • タイマー
  • Serial Peripheral Interface (SPI)
  • 1-Wire サブシステム
  • Linux Watchdog Support
  • Linux 仮想化サポート
  • Linux Input ドキュメント
  • Linux Hardware Monitoring
  • Linux GPU ドライバー開発者ガイド
  • セキュリティドキュメント
  • Linux サウンドサブシステムドキュメント
    • ALSA カーネル API ドキュメント
    • 設計と実装
    • ALSA SoC レイヤー
      • ALSA SoC Layer Overview
      • ASoC Codec Class Driver
      • ASoC Digital Audio Interface (DAI)
      • Dynamic Audio Power Management for Portable Devices
      • ASoC Platform Driver
      • ASoC Machine Driver
      • Audio Pops and Clicks
      • Audio Clocking
      • ASoC jack detection
      • Dynamic PCM
      • Creating codec to codec dai link for ALSA dapm
    • Advanced Linux Sound Architecture - ドライバー設定ガイド
    • HD-Audio
    • Card-Specific Information
  • Linux カーネル Crypto API
  • Linux ファイルシステム API
  • Linux メモリ管理ドキュメント
  • BPF ドキュメント
  • USB サポート
  • Linux PCI Bus Subsystem
  • Assorted Miscellaneous Devices Documentation
  • Intel Many Integrated Core (MIC) architecture
  • Linux スケジューラ
  • ARM アーキテクチャ
  • ARM64 アーキテクチャ
  • IA-64 アーキテクチャ
  • m68k アーキテクチャ
  • MIPS 固有のドキュメント
  • Linux on the Nios II architecture
  • OpenRISC アーキテクチャ
  • PA-RISC アーキテクチャ
  • powerpc
  • RISC-V アーキテクチャ
  • s390 アーキテクチャ
  • SuperH インターフェイスガイド
  • Sparc Architecture
  • x86-specific Documentation
  • Xtensa アーキテクチャ
  • ext4 のデータ構造とアルゴリズム
Arch Linux カーネルドキュメント
  • Docs »
  • Linux サウンドサブシステムドキュメント »
  • ALSA SoC レイヤー »
  • Creating codec to codec dai link for ALSA dapm

Creating codec to codec dai link for ALSA dapm¶

Mostly the flow of audio is always from CPU to codec so your system will look as below:

 ---------          ---------
|         |  dai   |         |
    CPU    ------->    codec
|         |        |         |
 ---------          ---------

In case your system looks as below:

                     ---------
                    |         |
                      codec-2
                    |         |
                    ---------
                         |
                       dai-2
                         |
 ----------          ---------
|          |  dai-1 |         |
    CPU     ------->  codec-1
|          |        |         |
 ----------          ---------
                         |
                       dai-3
                         |
                     ---------
                    |         |
                      codec-3
                    |         |
                     ---------

Suppose codec-2 is a bluetooth chip and codec-3 is connected to a speaker and you have a below scenario: codec-2 will receive the audio data and the user wants to play that audio through codec-3 without involving the CPU.This aforementioned case is the ideal case when codec to codec connection should be used.

Your dai_link should appear as below in your machine file:

/*
 * this pcm stream only supports 24 bit, 2 channel and
 * 48k sampling rate.
 */
static const struct snd_soc_pcm_stream dsp_codec_params = {
       .formats = SNDRV_PCM_FMTBIT_S24_LE,
       .rate_min = 48000,
       .rate_max = 48000,
       .channels_min = 2,
       .channels_max = 2,
};

{
   .name = "CPU-DSP",
   .stream_name = "CPU-DSP",
   .cpu_dai_name = "samsung-i2s.0",
   .codec_name = "codec-2,
   .codec_dai_name = "codec-2-dai_name",
   .platform_name = "samsung-i2s.0",
   .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
           | SND_SOC_DAIFMT_CBM_CFM,
   .ignore_suspend = 1,
   .params = &dsp_codec_params,
},
{
   .name = "DSP-CODEC",
   .stream_name = "DSP-CODEC",
   .cpu_dai_name = "wm0010-sdi2",
   .codec_name = "codec-3,
   .codec_dai_name = "codec-3-dai_name",
   .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
           | SND_SOC_DAIFMT_CBM_CFM,
   .ignore_suspend = 1,
   .params = &dsp_codec_params,
},

Above code snippet is motivated from sound/soc/samsung/speyside.c.

Note the "params" callback which lets the dapm know that this dai_link is a codec to codec connection.

In dapm core a route is created between cpu_dai playback widget and codec_dai capture widget for playback path and vice-versa is true for capture path. In order for this aforementioned route to get triggered, DAPM needs to find a valid endpoint which could be either a sink or source widget corresponding to playback and capture path respectively.

In order to trigger this dai_link widget, a thin codec driver for the speaker amp can be created as demonstrated in wm8727.c file, it sets appropriate constraints for the device even if it needs no control.

Make sure to name your corresponding cpu and codec playback and capture dai names ending with "Playback" and "Capture" respectively as dapm core will link and power those dais based on the name.

Note that in current device tree there is no way to mark a dai_link as codec to codec. However, it may change in future.

Next Previous

© Copyright The kernel development community

Built with Sphinx using a theme provided by Read the Docs.
Arch Linux JP Project
archlinux.jp
ホーム
パッケージ
フォーラム
ArchWiki
Slack
AUR
ダウンロード
kusakata.com
Kusakata's Lair
GitHub