From patchwork Tue Jan 26 14:34:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Horsley X-Patchwork-Id: 8123661 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B351C9F818 for ; Tue, 26 Jan 2016 14:37:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7C28E2026F for ; Tue, 26 Jan 2016 14:37:02 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 94B9A20270 for ; Tue, 26 Jan 2016 14:37:00 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 713ED2652CF; Tue, 26 Jan 2016 15:36:58 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id F22A326059E; Tue, 26 Jan 2016 15:36:21 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 00BF3265146; Tue, 26 Jan 2016 15:36:20 +0100 (CET) Received: from mailapp01.imgtec.com (mailapp01.imgtec.com [195.59.15.196]) by alsa0.perex.cz (Postfix) with ESMTP id B5F72260599 for ; Tue, 26 Jan 2016 15:36:12 +0100 (CET) Received: from hhmail02.hh.imgtec.org (unknown [10.100.10.20]) by Websense Email Security Gateway with ESMTPS id DBD9A9D95FC4E; Tue, 26 Jan 2016 14:36:08 +0000 (GMT) Received: from djh-ub64.kl.imgtec.org (192.168.167.68) by hhmail02.hh.imgtec.org (10.100.10.20) with Microsoft SMTP Server (TLS) id 14.3.235.1; Tue, 26 Jan 2016 14:36:10 +0000 From: Damien Horsley To: Date: Tue, 26 Jan 2016 14:34:26 +0000 Message-ID: <1453818867-16322-2-git-send-email-Damien.Horsley@imgtec.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1453818867-16322-1-git-send-email-Damien.Horsley@imgtec.com> References: <1453818867-16322-1-git-send-email-Damien.Horsley@imgtec.com> MIME-Version: 1.0 X-Originating-IP: [192.168.167.68] Cc: Mark Rutland , devicetree@vger.kernel.org, Pawel Moll , Ian Campbell , linux-kernel@vger.kernel.org, Mark Brown , Takashi Iwai , Liam Girdwood , Rob Herring , Kumar Gala , "Damien.Horsley" , James Hartley Subject: [alsa-devel] [RFC V2 1/2] ASoC: img: Add binding document for Pistachio audio card X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP From: "Damien.Horsley" Add a binding document for Pistachio audio card Signed-off-by: Damien.Horsley --- .../bindings/sound/img,pistachio-audio.txt | 308 +++++++++++++++++++++ 1 file changed, 308 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/img,pistachio-audio.txt diff --git a/Documentation/devicetree/bindings/sound/img,pistachio-audio.txt b/Documentation/devicetree/bindings/sound/img,pistachio-audio.txt new file mode 100644 index 0000000..ab5bf7f --- /dev/null +++ b/Documentation/devicetree/bindings/sound/img,pistachio-audio.txt @@ -0,0 +1,308 @@ +Imagination Technologies Pistachio Audio Card Driver + +Required properties: + + - compatible : Compatible list, must contain "img,pistachio-audio" + + - clocks : Contains an entry for each entry in clock-names + + - clock-names : Includes the following entries: + "audio_pll" The audio PLL + "i2s_mclk" The i2s reference clock + Also connected to i2s_out_0_mclk output + "dac_mclk" Dac reference clock. Connected to i2s_dac_clk output + + - img,cr-periph : phandle of the peripheral control syscon + node which contains the i2s loopback control registers + +Optional properties: + + - img,widgets : Please refer to widgets.txt + + - img,routing : A list of the connections between audio components + + - img,mute-gpio : phandle of the mute gpio + + - img,hp-det-gpio : phandle of the headphone detect gpio + + - img,i2s-clk-loopback : When present, the frame and bit clock signals for + the i2s out and i2s in controllers will be connected + internally + +Optional subnodes: + + - spdif-out : Contains spdif out information + + - spdif-in : Contains spdif in information + + - parallel-out : Contains parallel out information + + - i2s-out : Contains i2s out information + + - i2s-in : Contains i2s in information + +Required spdif-out, spdif-in subnode properties: + + - cpu-dai : phandle of spdif cpu dai + +Required parallel-out subnode properties: + + - cpu-dai : phandle of parallel out cpu dai + + - sound-dai : phandle of internal dac + +Required i2s-out, i2s-in subnode properties: + + - cpu-dai : phandle of i2s cpu dai + + - format : i2s format. "i2s" and "left_j" are supported by + the Pistachio iteration of the i2s controllers + +Optional i2s-out, i2s-in subnode properties: + + - bitclock-inversion : i2s bit clock inversion + + - frame-inversion : i2s frame clock inversion + + - continuous-clock : i2s bit and frame clock always active + +Optional i2s-out, i2s-in subnodes: + + - : Contains codec information. will be used as + the prefix for the codec. This name must be unique for + each individual codec (unique codec device node), and + cannot be equal to "internal-dac", "i2s-out" or "i2s-in". + The name should be short to avoid control name truncation + +Optional subnode properties: + + - mclk : Contains the mclk (master clock) used by the DAC/ADC. If no mclk + is required, or the mclk is provided externally, with no software + intervention required to compenstate for differing sample rates, + this can be omitted. + Valid identifiers (dt-bindings/sound/pistachio-audio.h): + + PISTACHIO_MCLK_I2S mclk is provided by the i2s_out_0_mclk + output from Pistachio SoC. This clock + is shared with the internal i2s out + controller + + PISTACHIO_MCLK_DAC mclk is provided by the i2s_dac_clk + output from Pistachio SoC + + - sound-dai : phandle of the codec. If the codec does not accept/require + software configuration, this can be omitted + + - mclk-index : Index of the mclk, used for snd_soc_dai_set_sysclk call. + 0 is used if this property is omitted + + - frame-master : Indicates this codec is the frame clock master + + - bitclock-master : Indicates this codec is the bit clock master + + frame-master and bitclock-master cannot exist in more than one of the codec + subnodes + + frame-master and bitclock-master cannot be used within i2s out codec subnodes + as the Pistachio iteration of the i2s out controller accepts master mode + only + + frame-master and bitclock-master can be omitted if img,i2s-clk-loopback is + used, or if frame/bit clock generation does not require software intervention + (eg a codec operating in hardware-mode) + +Required subnode properties if mclk property is present: + + - mclk-fs : Contains the set of fs ratios the DAC/ADC accepts (Nfs for + sample rate r specifies the master clock input to the DAC is + N times r). It is assumed this set of ratios is applicable to + any given sample rate where this does not lead to a violation + of the minimum/maximum frequencies specified by mclk-min-fs-freq + and mclk-max-fs-freq respectively + + - mclk-min-fs-freq : Contains the minimum frequency the DAC/ADC accepts for + the mclk-fs list above + + - mclk-max-fs-freq : Contains the maximum frequency the DAC/ADC accepts for + the mclk-fs list above + + - mclk-max-freq : Contains the maximum frequency for the DAC/ADC. Must be + greater than or equal to mclk-max-fs-freq + + +Example 1: + +All audio components present on board. 2x pcm3168a codecs provide 3 i2s in +and out channels each. dac_mclk provides the single master clock to both +codecs. The Pistachio i2s out controller is the frame + bit clock master for +the DAC path. The second pcm3168a codec is the frame + bit clock master for +the ADC path. GPIO 1 in bank 5 is used as a mute control (active low). GPIO 3 +in bank 5 is used for headphone detect control (active high) + +pistachio_audio_card { + compatible = "img,pistachio-audio"; + + clocks = <&clk_core CLK_AUDIO_PLL>, + <&clk_core CLK_I2S>, + <&clk_core CLK_AUDIO>; + clock-names = "audio_pll", "i2s_mclk", "dac_mclk"; + + img,cr-periph = <&cr_periph>; + + img,mute-gpio = <&gpio5 1 GPIO_ACTIVE_LOW>; + img,hp-det-gpio = <&gpio5 3 GPIO_ACTIVE_HIGH>; + + img,widgets = "Headphone", "Headphones", + "Speaker", "Speakers"; + + img,routing = "Headphones", "internal-dac AOUTL", + "Headphones", "internal-dac AOUTR", + "Speakers", "internal-dac AOUTL", + "Speakers", "internal-dac AOUTR"; + + spdif-out { + cpu-dai = <&spdif_out>; + }; + + spdif-in { + cpu-dai = <&spdif_in>; + }; + + parallel-out { + cpu-dai = <¶llel_out>; + sound-dai = <&internal_dac>; + }; + + i2s-out { + cpu-dai = <&i2s_out>; + format = "i2s"; + + pcm3168a-1 { + mclk = ; + mclk-fs = <128 192 256 384 512 768>; + mclk-min-fs-freq = <2048000>; + mclk-max-fs-freq = <36864000>; + mclk-max-freq = <36864000>; + sound-dai = <&pcm3168a_1 0>; + }; + + pcm3168a-2 { + mclk = ; + mclk-fs = <128 192 256 384 512 768>; + mclk-min-fs-freq = <2048000>; + mclk-max-fs-freq = <36864000>; + mclk-max-freq = <36864000>; + sound-dai = <&pcm3168a_2 0>; + }; + }; + + i2s-in { + cpu-dai = <&i2s_in>; + format = "i2s"; + + pcm3168a-1 { + mclk = ; + mclk-fs = <256 384 512 768>; + mclk-min-fs-freq = <2048000>; + mclk-max-fs-freq = <36864000>; + mclk-max-freq = <36864000>; + sound-dai = <&pcm3168a_1 1>; + }; + + pcm3168a-2 { + mclk = ; + mclk-fs = <256 384 512 768>; + mclk-min-fs-freq = <2048000>; + mclk-max-fs-freq = <36864000>; + mclk-max-freq = <36864000>; + sound-dai = <&pcm3168a_2 1>; + frame-master; + bitclock-master; + }; + }; +}; + +Example 2: + +i2s out, i2s in present on board. pcm5101 codec provides 1 i2s out channel. +pcm1802 codec provides 1 i2s in channel. dac_mclk provides master clock to +pcm1802. i2s_mclk provides master clock to pcm5101. Both codecs set to operate +in hardware mode. The Pistachio i2s out controller is the frame + bit clock +master for the DAC path. The pcm1802 codec is the frame + bit clock master for +the ADC path + +pistachio_audio_card { + compatible = "img,pistachio-audio"; + + clocks = <&clk_core CLK_AUDIO_PLL>, + <&clk_core CLK_I2S>, + <&clk_core CLK_AUDIO>; + clock-names = "audio_pll", "i2s_mclk", "dac_mclk"; + + img,cr-periph = <&cr_periph>; + + pinctrl-names = "default"; + pinctrl-0 = <&dac_clk_pin>, <&i2s_mclk_pin>; + + i2s-out { + cpu-dai = <&i2s_out>; + format = "i2s"; + + pcm5101 { + mclk = ; + mclk-fs = <128 192 256 384 512 768 1024 1152 1536 2048 3072>; + mclk-min-fs-freq = <1024000>; + mclk-max-fs-freq = <49152000>; + mclk-max-freq = <49152000>; + }; + }; + + i2s-in { + cpu-dai = <&i2s_in>; + format = "i2s"; + + pcm1802 { + mclk = ; + mclk-fs = <256>; + mclk-min-fs-freq = <8192000>; + mclk-max-fs-freq = <49152000>; + mclk-max-freq = <49152000>; + }; + }; +}; + +Example 3: + +i2s out, i2s in present on board. dac provides 1 i2s out channel. +microphone array provides 6 i2s in channels. No master clocks are required. +The Pistachio i2s out controller is the frame + bit clock master +for the DAC and microphone array paths. + +pistachio_audio_card { + compatible = "img,pistachio-audio"; + + clocks = <&clk_core CLK_AUDIO_PLL>, + <&clk_core CLK_I2S>, + <&clk_core CLK_AUDIO>; + clock-names = "audio_pll", "i2s_mclk", "dac_mclk"; + + img,cr-periph = <&cr_periph>; + + img,i2s-clk-loopback; + + i2s-out { + cpu-dai = <&i2s_out>; + format = "i2s"; + bitclock-inversion; + + dac { + sound-dai = <&simple-dac>; + }; + }; + + i2s-in { + cpu-dai = <&i2s_in>; + format = "left_j"; + frame-inversion; + }; +};