From patchwork Wed Aug 19 09:15:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Gerhold X-Patchwork-Id: 11723311 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DB7BB618 for ; Wed, 19 Aug 2020 09:17:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C39BC207DE for ; Wed, 19 Aug 2020 09:17:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gerhold.net header.i=@gerhold.net header.b="OLdYXz+8" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726640AbgHSJRA (ORCPT ); Wed, 19 Aug 2020 05:17:00 -0400 Received: from mo4-p01-ob.smtp.rzone.de ([85.215.255.54]:8345 "EHLO mo4-p01-ob.smtp.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726702AbgHSJQ7 (ORCPT ); Wed, 19 Aug 2020 05:16:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1597828616; s=strato-dkim-0002; d=gerhold.net; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=QF9pEdpob/aapYjgmPjRf6gK63aNdtYCv2gYZ1UtYsQ=; b=OLdYXz+8DQJbUYYOo9Hc/vXacWtxDbM9fkWBlnnJD2ECHlKRbg5tM9jUVI5lvjmkf0 SshCHT+GdRRPmbocsXrISqfGrjYbjjaIp/N4CbSxqeLco3J0482E0xZfRoeRV5l0TqGs KDSMufTfMeopInT+Jgl0S4MEggI6DXCS3ViZJi2XOI+J5C1+PWn5OLWUl/Uz1vGPXuXp UydTltxWcMsBh4qPLFwvw3JOtb6fTkuD6EsxTM4XAlXrcZw52YRaA/GIDrs3DWrdNa1X bm2znnX9gRCWG6MS40zYlZzDusPqOQZ4PRjF64+hEhYtsWjMoEXYV8O1r+XGIaB18A5j sR1g== X-RZG-AUTH: ":P3gBZUipdd93FF5ZZvYFPugejmSTVR2nRPhVORvLd4SsytBXS7IYBkLahKxB5m6NDwQo" X-RZG-CLASS-ID: mo00 Received: from localhost.localdomain by smtp.strato.de (RZmta 46.10.7 DYNA|AUTH) with ESMTPSA id g0b6c1w7J9Gt0ST (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Wed, 19 Aug 2020 11:16:55 +0200 (CEST) From: Stephan Gerhold To: Mark Brown Cc: Srinivas Kandagatla , Patrick Lai , Banajit Goswami , Liam Girdwood , alsa-devel@alsa-project.org, Rob Herring , devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, Stephan Gerhold Subject: [PATCH 1/2] ASoC: dt-bindings: qcom: Document "aux-devs" property Date: Wed, 19 Aug 2020 11:15:32 +0200 Message-Id: <20200819091533.2334-2-stephan@gerhold.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200819091533.2334-1-stephan@gerhold.net> References: <20200819091533.2334-1-stephan@gerhold.net> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org In some cases we need to probe additional audio components that do not appear as part of the DAI links specified in the device tree. Examples for this are auxiliary devices such as analog amplifiers or codecs. To make them work they need to be added as part of "aux-devs" and connected to some other audio component using the audio routes configurable using "(qcom,)audio-routing". Cc: Srinivas Kandagatla Signed-off-by: Stephan Gerhold --- .../devicetree/bindings/sound/qcom,apq8016-sbc.txt | 7 +++++++ Documentation/devicetree/bindings/sound/qcom,apq8096.txt | 8 ++++++++ Documentation/devicetree/bindings/sound/qcom,sdm845.txt | 8 ++++++++ 3 files changed, 23 insertions(+) diff --git a/Documentation/devicetree/bindings/sound/qcom,apq8016-sbc.txt b/Documentation/devicetree/bindings/sound/qcom,apq8016-sbc.txt index 84b28dbe9f15..23998262a0a7 100644 --- a/Documentation/devicetree/bindings/sound/qcom,apq8016-sbc.txt +++ b/Documentation/devicetree/bindings/sound/qcom,apq8016-sbc.txt @@ -34,6 +34,13 @@ Required properties: * DMIC * Ext Spk +Optional properties: + +- aux-devs : A list of phandles for auxiliary devices (e.g. analog + amplifiers) that do not appear directly within the DAI + links. Should be connected to another audio component + using "qcom,audio-routing". + Dai-link subnode properties and subnodes: Required dai-link subnodes: diff --git a/Documentation/devicetree/bindings/sound/qcom,apq8096.txt b/Documentation/devicetree/bindings/sound/qcom,apq8096.txt index c814e867850f..248df5056fec 100644 --- a/Documentation/devicetree/bindings/sound/qcom,apq8096.txt +++ b/Documentation/devicetree/bindings/sound/qcom,apq8096.txt @@ -55,6 +55,14 @@ This binding describes the APQ8096 sound card, which uses qdsp for audio. Value type: Definition: The user-visible name of this sound card. +- aux-devs + Usage: optional + Value type: + Definition: A list of phandles for auxiliary devices (e.g. analog + amplifiers) that do not appear directly within the DAI + links. Should be connected to another audio component + using "audio-routing". + = dailinks Each subnode of sndcard represents either a dailink, and subnodes of each dailinks would be cpu/codec/platform dais. diff --git a/Documentation/devicetree/bindings/sound/qcom,sdm845.txt b/Documentation/devicetree/bindings/sound/qcom,sdm845.txt index ca8c89e88bfa..3d5cbe953cf7 100644 --- a/Documentation/devicetree/bindings/sound/qcom,sdm845.txt +++ b/Documentation/devicetree/bindings/sound/qcom,sdm845.txt @@ -24,6 +24,14 @@ This binding describes the SDM845 sound card, which uses qdsp for audio. Value type: Definition: The user-visible name of this sound card. +- aux-devs + Usage: optional + Value type: + Definition: A list of phandles for auxiliary devices (e.g. analog + amplifiers) that do not appear directly within the DAI + links. Should be connected to another audio component + using "audio-routing". + = dailinks Each subnode of sndcard represents either a dailink, and subnodes of each dailinks would be cpu/codec/platform dais. From patchwork Wed Aug 19 09:15:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Gerhold X-Patchwork-Id: 11723313 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DE2D5618 for ; Wed, 19 Aug 2020 09:17:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BB8A3207BB for ; Wed, 19 Aug 2020 09:17:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gerhold.net header.i=@gerhold.net header.b="LTy05T0S" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726873AbgHSJRE (ORCPT ); Wed, 19 Aug 2020 05:17:04 -0400 Received: from mo4-p02-ob.smtp.rzone.de ([81.169.146.168]:14350 "EHLO mo4-p02-ob.smtp.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726919AbgHSJRB (ORCPT ); Wed, 19 Aug 2020 05:17:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1597828616; s=strato-dkim-0002; d=gerhold.net; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=O63GLG7sddoCYObzLYc9FbVF3AO3J5EaI5KdyvqBGk8=; b=LTy05T0SmpCIdrJFcV+DLV/fKSUd+aM6G8+wa6ZBnD1anavArp3yoofhZO17+UenKi 5cpJInbeOsmghuZk1ib9FpBC8BGHiHJ1GNDiCPoMLEYHADBd8UZmW8/zBuaLKV+oi3EN Czjf00kJ5T7RH8lP2cALAnxf2B57oTOiUYmB0u/1xbQz4zf4NoO2V1nePHNQUkAY7w4L JAG0GdycG/C4UOfeIfUBs3dMrCepqi2/jkx5D6Cz1fNbonxPhYfRwnhrMxvWTm0eyZdt 5DVAdS/SaPnsJ3Idaa9BijWcsBKlgyf2UhAv7MBDtZuzWgQqHFjtOyoS9In24OLpj26v TiIg== X-RZG-AUTH: ":P3gBZUipdd93FF5ZZvYFPugejmSTVR2nRPhVORvLd4SsytBXS7IYBkLahKxB5m6NDwQo" X-RZG-CLASS-ID: mo00 Received: from localhost.localdomain by smtp.strato.de (RZmta 46.10.7 DYNA|AUTH) with ESMTPSA id g0b6c1w7J9Gu0SU (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Wed, 19 Aug 2020 11:16:56 +0200 (CEST) From: Stephan Gerhold To: Mark Brown Cc: Srinivas Kandagatla , Patrick Lai , Banajit Goswami , Liam Girdwood , alsa-devel@alsa-project.org, Rob Herring , devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, Stephan Gerhold Subject: [PATCH 2/2] ASoC: qcom: common: Parse auxiliary devices from device tree Date: Wed, 19 Aug 2020 11:15:33 +0200 Message-Id: <20200819091533.2334-3-stephan@gerhold.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200819091533.2334-1-stephan@gerhold.net> References: <20200819091533.2334-1-stephan@gerhold.net> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org In some cases we need to probe additional audio components that do not appear as part of the DAI links specified in the device tree. Examples for this are auxiliary devices such as analog amplifiers or codecs. The ASoC core provides a way to probe these components by adding them to snd_soc_card->aux_dev. We can use the snd_soc_of_parse_aux_devs() function to parse them from the device tree. As an example for this, some MSM8916 smartphones have an analog speaker amplifier connected to the HPHR output. With the new property this can be modelled as follows: speaker-amp: audio-amplifier { compatible = "simple-audio-amplifier"; enable-gpios = <&msmgpio 114 GPIO_ACTIVE_HIGH>; sound-name-prefix = "Speaker Amp"; }; &sound { aux-devs = <&speaker_amp>; audio-routing = "Speaker Amp IN", "HPHR"; }; Cc: Srinivas Kandagatla Signed-off-by: Stephan Gerhold --- sound/soc/qcom/common.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sound/soc/qcom/common.c b/sound/soc/qcom/common.c index 5194d90ddb96..fe6e778c31c0 100644 --- a/sound/soc/qcom/common.c +++ b/sound/soc/qcom/common.c @@ -39,6 +39,10 @@ int qcom_snd_parse_of(struct snd_soc_card *card) return ret; } + ret = snd_soc_of_parse_aux_devs(card, "aux-devs"); + if (ret) + return ret; + /* Populate links */ num_links = of_get_child_count(dev->of_node);