From nobody Sun Feb 8 05:20:00 2026 Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7FF332D9EC8 for ; Fri, 30 Jan 2026 13:34:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.66 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769780089; cv=none; b=iZYWmnaNH0ktMYh75x8PJGr7aobFbR3pVnwD1jZkoyzBh1ekfK75kWi2QKhaSL0gqS5Ne02SmRx/6UMEsVs6XPg9Cv5MQSxlbAL9tmBaHxFxtmsEMSg0JMKmM+g7PF/LCqfuSWh78cmFB8E5HxOuToR6dXpBWNt1iip/cxot4ZY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769780089; c=relaxed/simple; bh=c0WSaIWh0GbMsdsZOfpY4fsWR+IwyVApzYh2Vgu5YlU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Jq6yGtcbyisPdLFdKa0k5EE2m8oI6u5inPYWIyQFfcWjMBoRPHWqo8J0MxbGGtdwbQXJ0g2A+uSkGeyypjGPLNBvBZrymtbtgSyJAn8PMoskht7EiP5ntiVTotknNydJzU2frolyVmNTj0YuXMPB8V8lS6AbdNuACUV3Hb1Bvmo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=mr81r7pw; arc=none smtp.client-ip=209.85.221.66 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="mr81r7pw" Received: by mail-wr1-f66.google.com with SMTP id ffacd0b85a97d-432d2c7a8b9so1976492f8f.2 for ; Fri, 30 Jan 2026 05:34:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1769780086; x=1770384886; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=AoCRYLFgaaOwIEgPrhUSNB9d+/cz6LVHg1Zx25jjT1E=; b=mr81r7pwnJKNFpLJcYKHJnwpihsXpmONgyOcHB248+4JfXCwJUcoziEv5N7o3KSral p3QwuJvPCTyRA+VYWb+DCW1gy+pLj/XrksfA8MMydtYJHoFkgruLMwOWT58Ff6qMwx6e ga7svtLnobwRoB9m6TJXLjQ9jo1b1L5R0Uf9auck+6pil2HvXofNbBoWan7hfJOUAAhM syUzqucaO8fEZPXVHIgcYUP8rgNYXsrLESjHODHQxUu1HPPN3gfI8Id0Pec2TeVtJq7H aLD+WLLO93aansf/O0kXs2EOpHfVJeKgfcWijKEGQFj3jQ8xcCIqb6+z6S/cdAMG4+Oc 891Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769780086; x=1770384886; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=AoCRYLFgaaOwIEgPrhUSNB9d+/cz6LVHg1Zx25jjT1E=; b=Ros1waKpbV82Y6U+ZIYaE1sOKV982EhBN4Sc29zo6uZzNLSgihuc3CBYl1KlWK9Bmr Ib8xU7M+fGr3WeJZ5dTpyOBHd3NovRIZKaEeAf+O+M9rU75zxOIAlVyL3oSHRcL63NqC cEBAFBGWXb0GMTYo/ViwklS0G/Y/t5VhGI5LsMVTKfN79K6RyAXZ/P1Sm/+ctdympgSu us1iXHHziFjshnlcman+QyOPQPQh4PcmF1DfcmYX+9M0nmM+noeccexe9U1JNUUKI9Sb lLjUm9KuSQNqiwGOyOz0wHQX6iqDgP13+GDyWi5j42C7gqksReZyWRRp8dM/GqaKr1ch /ANg== X-Forwarded-Encrypted: i=1; AJvYcCXn27Crr/RDPOVTOd1FnHyqNO6IxahgANZqTdwPQ0o+AMtmyuvT+rkZ8aZE3Xb142UAQNVUPtmFS9xXIo0=@vger.kernel.org X-Gm-Message-State: AOJu0YzrzMF7I1QyFpTA7KCVnNkMyUHaCkjOYZl4L3jbh2EUoBQaZRjM RDGrcppBUMXFEchq1KF+tgZ75eSilb/nLUoNpj1wpy02JFSjY9qU8PyL X-Gm-Gg: AZuq6aLixGU52eW4ojsN3yKiZvn5b1Zw+K29SogyENdR9VJuLknPCwE/Z9lviFOmTKC WLwAGeQK65ouoA9CekeJtGXjFD8YDIPpbNLJCKsQyc95yj5k7BYj0jX++uutdGk6OXfNVl/75Vh sZdzqYIyYs7hUWaPvpX/9zBl5UGwRFCnI9g6SmEaQo0LX+h/4xpacB8pCezN3FhN3RryXtMYdn9 4w6iyDY8i7nwqKr542+XdXulgJ/BV6ROdXRvcjTRJzomhQkCPJCNH6ekoJqcWypIKvrITX+c8pv shht4M15bdtPMzyenKkiqKznN8xvWo3M6hZBKmZJTaC8lx6tXiTyn/56dR5fLzZ6V7ofEXd+/X/ 9mtnUx6KLZY3QR9kudwCMu1490T92NXaFkyDjyO/tg3SqPAMmzrQ3ppZiy3RapP2YJ3lKXxOk3Z Bks1r5in7Qlo0= X-Received: by 2002:a05:6000:4023:b0:430:f68f:ee7d with SMTP id ffacd0b85a97d-435f3aafe9cmr4441580f8f.47.1769780085489; Fri, 30 Jan 2026 05:34:45 -0800 (PST) Received: from xeon ([188.163.112.49]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-435e131ce93sm21536837f8f.24.2026.01.30.05.34.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Jan 2026 05:34:45 -0800 (PST) From: Svyatoslav Ryhel To: Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Thierry Reding , Jonathan Hunter , Jaroslav Kysela , Takashi Iwai , Svyatoslav Ryhel , =?UTF-8?q?Jonas=20Schw=C3=B6bel?= Cc: linux-sound@vger.kernel.org, devicetree@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 1/4] ASoC: dt-bindings: nvidia,tegra-audio: document CPCAP CODEC Date: Fri, 30 Jan 2026 15:34:31 +0200 Message-ID: <20260130133434.353353-2-clamor95@gmail.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260130133434.353353-1-clamor95@gmail.com> References: <20260130133434.353353-1-clamor95@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add dt-binding for CPCAP CODEC. Signed-off-by: Svyatoslav Ryhel --- .../sound/nvidia,tegra-audio-cpcap.yaml | 85 +++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/nvidia,tegra-au= dio-cpcap.yaml diff --git a/Documentation/devicetree/bindings/sound/nvidia,tegra-audio-cpc= ap.yaml b/Documentation/devicetree/bindings/sound/nvidia,tegra-audio-cpcap.= yaml new file mode 100644 index 000000000000..0af6bd3bf639 --- /dev/null +++ b/Documentation/devicetree/bindings/sound/nvidia,tegra-audio-cpcap.yaml @@ -0,0 +1,85 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/sound/nvidia,tegra-audio-cpcap.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: NVIDIA Tegra audio complex with CPCAP CODEC + +maintainers: + - Svyatoslav Ryhel + +allOf: + - $ref: nvidia,tegra-audio-common.yaml# + +properties: + compatible: + items: + - pattern: '^[a-z0-9]+,tegra-audio-cpcap(-[a-z0-9]+)+$' + - const: nvidia,tegra-audio-cpcap + + nvidia,audio-routing: + $ref: /schemas/types.yaml#/definitions/non-unique-string-array + description: + A list of the connections between audio components. Each entry is a + pair of strings, the first being the connection's sink, the second + being the connection's source. Valid names for sources and sinks are + the pins (documented in the binding document), and the jacks on the + board. + minItems: 2 + items: + enum: + # Board Connectors + - Int Spk + - Headphones + - Earpiece + - Headset Mic + - Internal Mic 1 + - Internal Mic 2 + + # CODEC Pins + - MICR + - HSMIC + - EMUMIC + - MICL + - EXTR + - EXTL + - EP + - SPKR + - SPKL + - LINER + - LINEL + - HSR + - HSL + - EMUR + - EMUL + +unevaluatedProperties: false + +examples: + - | + #include + #include + sound { + compatible =3D "motorola,tegra-audio-cpcap-mot", + "nvidia,tegra-audio-cpcap"; + nvidia,model =3D "Motorola Atrix 4G (MB860) CPCAP"; + + nvidia,audio-routing =3D + "Headphones", "HSR", + "Headphones", "HSL", + "Int Spk", "SPKR", + "Int Spk", "SPKL", + "Earpiece", "EP", + "HSMIC", "Headset Mic", + "MICR", "Internal Mic 1", + "MICL", "Internal Mic 2"; + + nvidia,i2s-controller =3D <&tegra_i2s1>; + nvidia,audio-codec =3D <&cpcap_audio>; + + clocks =3D <&tegra_car TEGRA20_CLK_PLL_A>, + <&tegra_car TEGRA20_CLK_PLL_A_OUT0>, + <&tegra_car TEGRA20_CLK_CDEV1>; + clock-names =3D "pll_a", "pll_a_out0", "mclk"; + }; --=20 2.51.0 From nobody Sun Feb 8 05:20:00 2026 Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 59401302CAB for ; Fri, 30 Jan 2026 13:34:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769780090; cv=none; b=FxUtt8SSpPwcf3j4T658WL8JzkCwsuePJqEwCZ5NOI+urDbJanElwuBj1EG61MNuSD1HxJ8wavQJ0UP+c4iglDvTP3Rznk02rjhcN+RixfIqQX03f6Ds0Dh8wDoco4LfksK77EUPhPScWXd81UML9he/gsylDsq9EYmAklxoH7o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769780090; c=relaxed/simple; bh=Ywe9bPVypE5wkrLXuYYavaxat+KMj7tKegs5WxEIihs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EkzOLBR7hXI5N147svedLGWgI7QQ0vVpQGJvz7KJr0qRQwjHivJdHCYCNpSxAT98gPxU/jaFtr1/zI8CbdnbIxcYdOShp/cEkcEvJlhcVVJ2kyH7fmbpjGmIvcu+ESXA/fR0E2yTYsjV3AM4W+JiWlP+dDTPQBXINzb+Gr4tc2o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ZvlYOdjL; arc=none smtp.client-ip=209.85.221.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZvlYOdjL" Received: by mail-wr1-f48.google.com with SMTP id ffacd0b85a97d-435a11957f6so1792202f8f.0 for ; Fri, 30 Jan 2026 05:34:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1769780087; x=1770384887; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Vcw3yENIvlldxKIBwPqE+wjXhTrfY3vndqTsUZd8d80=; b=ZvlYOdjL9bok27WwllLtYYOj3wChHo70r+ULhziffZ7UkEiBIOjuBCLPDoJ2JlNv7a ecUW7Q1m6WUIoVnyJ4R9Fo6ROpdh+OH9vBUdAHvgkZD3egnYOcyoQ1K1pFcyW8RzKELx +w2YN8f4FlRk198rg09Fd+c6WD8/amh7dDOVA3N0uA4I+hs4IVdG1szPfGmiN+idbiwI Kp6C2bwULdTiFhA4gtj9imTXlsNkekjpBtEaki/MF6i4lcwFWnhSbWbjTtMU8nbbCKBH nljWhgSa57bdqLIb/w2hVmrO25cDAmfGWHzxmdg06CRE1/Mp4glc2HWTjl13mWBX44fR fXJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769780087; x=1770384887; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=Vcw3yENIvlldxKIBwPqE+wjXhTrfY3vndqTsUZd8d80=; b=J57h4ru05dBXMvwL71KkrSByTqeMympJ4zkRKopXO96WrNq2p8SQnTGitX+cq0NsQ4 /nDeamjfwfTciWLiQPpQUFe+I2KZt8NPSJVkRdlp6+80Jd95v6+3Zeuz9JS/DykZzMjY sMHA8CD41ihR8dPXMtK64gwgrIKfDZvTKVIDD/uMkBubpsS/R82nUICzcfbnMANkuXLi uW5ePT7FO5XiWQFVucEdvh68eWwZHJVEYxQG0LaUxrRPVcgFtfUuBCM3X/y21JgknMmC q/7ZhQtMEpcOIZ0yg67EmG3/yrX946vRWUqs+ftEsgKqF2Mmn5zC0j7iTRRqikLKJ2gJ IZew== X-Forwarded-Encrypted: i=1; AJvYcCVc6U1tqVQO20p2Dk+HQk5SNN8hmomFFKBnc8r+d/6G81NVCUURkUlEt+6/24SoCVWiXfmyH9skAoCn1L8=@vger.kernel.org X-Gm-Message-State: AOJu0YyZtDyDcJCtLM5+9vRI3Vnifk8MgHuUbIEt+piHhotI13rLGJsC 64TopUvIFBNlWpWKXuEPSWgpgs7HdljC62Dv9KNwO9VO5ocrS2Ksx7ba X-Gm-Gg: AZuq6aKcbnQAAdg5K3ibphuMD7D2Z3iN4aszNXYSMt09N6bax+axZGQhF518PtAQeOt /R+L4EpONw5q+oRNDz7XrXXlrm6zmFa3FYcXvLPfugX4WLE8ZcGO2KNC4BcKoVq+ITAy7cgtwKw 5t+8mRfNln0bH8RTlmWQJ0EI0e/SvGxm0EVz1SXD3eWS3hxzQdMgw1L5jRGOGMHnM6lTyBQeAg8 j+Zx22ZBIJHQu4AQiCokMLQO70qgUkzVA8XbSM+oWj6fHR0rnuSMNn48yfMXqsReNxORbXnH530 16kc5v0iicvGtyt3jzp2lMHgNsIOM/M6ADjGCwa4ttv3OIEUZaaWhxD2odNhnJX7wwhYYgPRrrO Hz1KIHCt4vs1ufcxfXBrBrHM7L4apTNmAHLR0XleRp6o6dkDC77ie0nBRGnnm3hdTuls1Hu6mZm on X-Received: by 2002:a05:6000:2905:b0:432:5bac:3915 with SMTP id ffacd0b85a97d-435f3aaa63fmr4508396f8f.39.1769780086599; Fri, 30 Jan 2026 05:34:46 -0800 (PST) Received: from xeon ([188.163.112.49]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-435e131ce93sm21536837f8f.24.2026.01.30.05.34.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Jan 2026 05:34:46 -0800 (PST) From: Svyatoslav Ryhel To: Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Thierry Reding , Jonathan Hunter , Jaroslav Kysela , Takashi Iwai , Svyatoslav Ryhel , =?UTF-8?q?Jonas=20Schw=C3=B6bel?= Cc: linux-sound@vger.kernel.org, devicetree@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 2/4] ASoC: tegra: Support CPCAP by machine driver Date: Fri, 30 Jan 2026 15:34:32 +0200 Message-ID: <20260130133434.353353-3-clamor95@gmail.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260130133434.353353-1-clamor95@gmail.com> References: <20260130133434.353353-1-clamor95@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add CPCAP codec support to the Tegra ASoC machine driver. This codec is found in Motorola T20 devices like Atrix 4G and Droid X2. Signed-off-by: Svyatoslav Ryhel --- sound/soc/tegra/Kconfig | 9 +++++ sound/soc/tegra/tegra_asoc_machine.c | 52 ++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) diff --git a/sound/soc/tegra/Kconfig b/sound/soc/tegra/Kconfig index 9dbd589879fb..f9257830daa1 100644 --- a/sound/soc/tegra/Kconfig +++ b/sound/soc/tegra/Kconfig @@ -294,6 +294,15 @@ config SND_SOC_TEGRA_SGTL5000 boards using the SGTL5000 codec, such as Apalis T30, Apalis TK1 or Colibri T30. =20 +config SND_SOC_TEGRA_CPCAP + tristate "SoC Audio support for Tegra boards using a CPCAP codec" + depends on I2C && GPIOLIB + select SND_SOC_TEGRA_MACHINE_DRV + select SND_SOC_CPCAP + help + Say Y or M here if you want to add support for SoC audio on Tegra + boards using the CPCAP codec, such as Motorola Atrix 4G or Droid X2. + endif =20 endmenu diff --git a/sound/soc/tegra/tegra_asoc_machine.c b/sound/soc/tegra/tegra_a= soc_machine.c index d48463ac16fc..10834f9c3422 100644 --- a/sound/soc/tegra/tegra_asoc_machine.c +++ b/sound/soc/tegra/tegra_asoc_machine.c @@ -287,6 +287,25 @@ static unsigned int tegra_machine_mclk_rate_6mhz(unsig= ned int srate) return mclk; } =20 +static unsigned int tegra_machine_mclk_rate_cpcap(unsigned int srate) +{ + unsigned int mclk; + + switch (srate) { + case 11025: + case 22050: + case 44100: + case 88200: + mclk =3D 26000000; + break; + default: + mclk =3D 256 * srate; + break; + } + + return mclk; +} + static int tegra_machine_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) { @@ -985,6 +1004,38 @@ static const struct tegra_asoc_data tegra_rt5631_data= =3D { .add_hp_jack =3D true, }; =20 +/* CPCAP machine */ + +SND_SOC_DAILINK_DEFS(cpcap_hifi, + DAILINK_COMP_ARRAY(COMP_EMPTY()), + DAILINK_COMP_ARRAY(COMP_CODEC(NULL, "cpcap-hifi")), + DAILINK_COMP_ARRAY(COMP_EMPTY())); + +static struct snd_soc_dai_link tegra_cpcap_dai =3D { + .name =3D "CPCAP", + .stream_name =3D "CPCAP PCM", + .init =3D tegra_asoc_machine_init, + .dai_fmt =3D SND_SOC_DAIFMT_I2S | + SND_SOC_DAIFMT_NB_NF | + SND_SOC_DAIFMT_CBP_CFP, + SND_SOC_DAILINK_REG(cpcap_hifi), +}; + +static struct snd_soc_card snd_soc_tegra_cpcap =3D { + .components =3D "codec:cpcap", + .dai_link =3D &tegra_cpcap_dai, + .num_links =3D 1, + .fully_routed =3D true, +}; + +static const struct tegra_asoc_data tegra_cpcap_data =3D { + .mclk_rate =3D tegra_machine_mclk_rate_cpcap, + .card =3D &snd_soc_tegra_cpcap, + .add_common_dapm_widgets =3D true, + .add_common_controls =3D true, + .add_common_snd_ops =3D true, +}; + static const struct of_device_id tegra_machine_of_match[] =3D { { .compatible =3D "nvidia,tegra-audio-trimslice", .data =3D &tegra_trimsl= ice_data }, { .compatible =3D "nvidia,tegra-audio-max98090", .data =3D &tegra_max9809= 0_data }, @@ -997,6 +1048,7 @@ static const struct of_device_id tegra_machine_of_matc= h[] =3D { { .compatible =3D "nvidia,tegra-audio-rt5640", .data =3D &tegra_rt5640_da= ta }, { .compatible =3D "nvidia,tegra-audio-alc5632", .data =3D &tegra_rt5632_d= ata }, { .compatible =3D "nvidia,tegra-audio-rt5631", .data =3D &tegra_rt5631_da= ta }, + { .compatible =3D "nvidia,tegra-audio-cpcap", .data =3D &tegra_cpcap_data= }, {}, }; MODULE_DEVICE_TABLE(of, tegra_machine_of_match); --=20 2.51.0 From nobody Sun Feb 8 05:20:00 2026 Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D4091305E1F for ; Fri, 30 Jan 2026 13:34:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.68 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769780102; cv=none; b=fvjLnBDdVw2V7Qoe6jEIL4wNWLLQX2696sodIvvynSDJw1tb6xTyQjNUa1Bo+v+k4cJU3r2NETxIhVXW4iL4cCkNsXR8NRFacdTHqJcb6i7hi0R08bEyJbQ4zmdfaXeBzWeiP82UwqcsBmDPikLwpfWFLcQ0tFYRiHJPFA6abEs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769780102; c=relaxed/simple; bh=E50Z0kZ8QEC/+gID4A4p9F54kc2DuevigG1LcHQ1FUU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ECvoN9HUZnG5eJygQjMVG6430zJHIPnAiwdfd7pH7mLK4MQ2wmrfoAMs6cuKpj0AnikoOcxlgvOSwB1vubjLh4pFtsXQmroc7sepDI8mnEFZxnU+kiHKzovm4/6vAN/Ng6rJ18iJobdsEIp7KmkNgHDCxTN5kLPb5ottz4ACffI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=P0WJDHqW; arc=none smtp.client-ip=209.85.221.68 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="P0WJDHqW" Received: by mail-wr1-f68.google.com with SMTP id ffacd0b85a97d-43596062728so2072214f8f.1 for ; Fri, 30 Jan 2026 05:34:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1769780095; x=1770384895; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=CDk6pvEbCDbKFm0MEs5hS5v1vRZPcd+sQDBn0D1BQXQ=; b=P0WJDHqWGnYnB3jZNkeY8R2g9r0jVnSA7XXv9FUVti86QLM1uWm3H0E+eK05IUfeuo bqXVxEIrvP57n+iDki1shcVVbe4xe37pAqMT5YwZP3sQcXZtT3JZLASyI9+8IdDn8IKW i00eDnwjl8dnl6Iy6zG6hzEvkYxfhwZA4eDOQZ09NqHgRTq4OB8F0p0ISgsTftsQsouJ 13VlFmn2DEmg5dwc27LIH+SugKoUu2UpH69xCTj3ovByw8IYEZuuwU6+knSabjuoYckd TQQcslb9vUxdfxWzlWqZp2fI5NXGvHOzACPAKYKTk8XelxtftIhtZi8H9qeLyxesSHOG 2uXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769780095; x=1770384895; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=CDk6pvEbCDbKFm0MEs5hS5v1vRZPcd+sQDBn0D1BQXQ=; b=UCLBChyuD5m6BXZIvz53SI/9qLlETFunuoTnkdcg5RxIPJIYnnA/kFXB2ogv2aQcZ8 etAmP1KeRQ9+Lf2r/0afDDG9gKTcftbRbADo2ZL5/Pv26HFbxgHtvarqQQ45EG01Lai6 xYcUxLxC4+dLqeZIEYfYCAgc9/AsV9wC1gXbz7Uzpu4SaOjiO6ZobiS81x0CKJZPdc6V HTc4/1U7lZkwdgMVWdR+GCs6+l5D8/FUqUqsZt09BhhFYc5Gpy7VzIjSvRGoSZvUU/Oi SCH16LwYdezWczUm+sCUzqG1ZfcLuScAbzmDCirWsrZnLNN9FyPoti8w2CTZr1Rz8SRp vFEA== X-Forwarded-Encrypted: i=1; AJvYcCXpwR1Ingc5R7F7iPzejresLQjKLbOKNbYJR+14EXQb+tH71makh9Ge46W8GnfROybodIe5uU51DOS+AyY=@vger.kernel.org X-Gm-Message-State: AOJu0YyV/ybyIwztF58Fs3nC24RZpk5ipt/M7KT16tZ8n1SILthNirnT M6IEYuyIOGKByBRs6AgL+KEo7IF/fGVu7rJoQO8RofFwUUlHUPBuHilV X-Gm-Gg: AZuq6aIT0Lhnt6yR7PeTyIchepIFY9V41B5Lta65BqHk2YqKPNOnFd/v8OV0InI0VMH FjNJU+8unEx0TWyM+YmtF8Oe86XAjZvJusxhcGPdfTWccBkl43fyAPdQZAVscOYxTqdbTB0F/VJ MJQkeMBturwqbHOceGsNDdudJoL3ft386NqAze3R3IX+FKgG5sOXmJlVzuzv29TP/AzEMVy9eRI HIIt6AnHvyWwKlZSKsJpC8ya6Djx4lNV8OjE1MHxVD8P//ZsvNDhrq3qkiDWx1PXUloIhbsCuXN QpjQ3zB99lpHYyljwOgQauBPMXRPpx7vtH449EQ+zse4X1KcesehVVD0Lua42yX+esIDxvhIBmK rx/RzdpPIAPcgjaOEdSP3Tku65RLcwNlJ8Zs1QngHL0nipoikIWERgmxSjNpfL7gR+1qt+/xBz7 wM X-Received: by 2002:a05:6000:3105:b0:435:932e:f932 with SMTP id ffacd0b85a97d-435f429d77emr3966731f8f.7.1769780095157; Fri, 30 Jan 2026 05:34:55 -0800 (PST) Received: from xeon ([188.163.112.49]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-435e131ce93sm21536837f8f.24.2026.01.30.05.34.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Jan 2026 05:34:47 -0800 (PST) From: Svyatoslav Ryhel To: Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Thierry Reding , Jonathan Hunter , Jaroslav Kysela , Takashi Iwai , Svyatoslav Ryhel , =?UTF-8?q?Jonas=20Schw=C3=B6bel?= Cc: linux-sound@vger.kernel.org, devicetree@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 3/4] ASoC: dt-bindings: nvidia,tegra-audio: document WM8962 CODEC Date: Fri, 30 Jan 2026 15:34:33 +0200 Message-ID: <20260130133434.353353-4-clamor95@gmail.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260130133434.353353-1-clamor95@gmail.com> References: <20260130133434.353353-1-clamor95@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add dt-binding for WM8962 CODEC. Signed-off-by: Svyatoslav Ryhel --- .../sound/nvidia,tegra-audio-wm8962.yaml | 88 +++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/nvidia,tegra-au= dio-wm8962.yaml diff --git a/Documentation/devicetree/bindings/sound/nvidia,tegra-audio-wm8= 962.yaml b/Documentation/devicetree/bindings/sound/nvidia,tegra-audio-wm896= 2.yaml new file mode 100644 index 000000000000..2c3bf5a02a34 --- /dev/null +++ b/Documentation/devicetree/bindings/sound/nvidia,tegra-audio-wm8962.yaml @@ -0,0 +1,88 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/sound/nvidia,tegra-audio-wm8962.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: NVIDIA Tegra audio complex with WM8962 CODEC + +maintainers: + - Svyatoslav Ryhel + +allOf: + - $ref: nvidia,tegra-audio-common.yaml# + +properties: + compatible: + items: + - pattern: '^[a-z0-9]+,tegra-audio-wm8962(-[a-z0-9]+)+$' + - const: nvidia,tegra-audio-wm8962 + + nvidia,audio-routing: + $ref: /schemas/types.yaml#/definitions/non-unique-string-array + description: + A list of the connections between audio components. Each entry is a + pair of strings, the first being the connection's sink, the second + being the connection's source. Valid names for sources and sinks are + the pins (documented in the binding document), and the jacks on the + board. + minItems: 2 + items: + enum: + # Board Connectors + - Speakers + - Int Spk + - Earpiece + - Int Mic + - Headset Mic + - Internal Mic 1 + - Internal Mic 2 + - Headphone + - Headphones + - Headphone Jack + - Mic Jack + + # CODEC Pins + - IN1L + - IN1R + - IN2L + - IN2R + - IN3L + - IN3R + - IN4L + - IN4R + - DMICDAT + - HPOUTL + - HPOUTR + - SPKOUT + - SPKOUTL + - SPKOUTR + +required: + - nvidia,i2s-controller + +unevaluatedProperties: false + +examples: + - | + #include + #include + sound { + compatible =3D "microsoft,tegra-audio-wm8962-surface-rt", + "nvidia,tegra-audio-wm8962"; + nvidia,model =3D "Microsoft Surface RT WM8962"; + + nvidia,audio-routing =3D + "Headphone Jack", "HPOUTR", + "Headphone Jack", "HPOUTL", + "Int Spk", "SPKOUTR", + "Int Spk", "SPKOUTL"; + + nvidia,i2s-controller =3D <&tegra_i2s1>; + nvidia,audio-codec =3D <&wm8962>; + + clocks =3D <&tegra_car TEGRA30_CLK_PLL_A>, + <&tegra_car TEGRA30_CLK_PLL_A_OUT0>, + <&tegra_pmc TEGRA_PMC_CLK_OUT_1>; + clock-names =3D "pll_a", "pll_a_out0", "mclk"; + }; --=20 2.51.0 From nobody Sun Feb 8 05:20:00 2026 Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 349773009EE for ; Fri, 30 Jan 2026 13:34:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769780102; cv=none; b=KI9K49QyB4/GjcyLfnw5x8FxvDUcLWWQL4MCXdmBg/FdK6S1icPkOIERUX4DdJ3m8VnEIj0xEfmWc7g3F3BOso3qw/vIhqVGdFsoL2kcrf3qLM+rfymlPCPNdAwCx68GW83R/5KowRbKDFDSVZ9lsnzu53nb8tpCiw9kSKYg/Zw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769780102; c=relaxed/simple; bh=D2udKOIgRxYLN++wJlYNmDyuzLLhyWkSNCE7NFH6d+E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=VtCuftF4gMyauHs6eqKM5+6wWb+S1x/kaVk97dL+czms9v/5P3u3GxwlsI9goXoreuh7N59W/SI2P1ot4zx7TFVPeIAx8wZGzxryG4o6yfiiCE+iwIKAbwmAQBqUKEPMUT3q7Lxd5jAOLyvEIN43WBlQvvmgR4IObbJzEp+vMpA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=eJnK2kNm; arc=none smtp.client-ip=209.85.221.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="eJnK2kNm" Received: by mail-wr1-f44.google.com with SMTP id ffacd0b85a97d-435a11957f6so1792340f8f.0 for ; Fri, 30 Jan 2026 05:34:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1769780096; x=1770384896; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=lKvxKGZ/wM7it4bTsO0Z3rMS2mHTFWTEN2O02PyhYlQ=; b=eJnK2kNmw3iqt/rG3pKu3Kgb1Pjsgc2LnOWPktXTT0SCHFcqEdpIX1JfxSwGs3nNoM YZZvWqnGqO4zHbJ/jbHE8NCWyd2lEqpEimm8Nv4LVnxDulyBtqScBMkgOtatrfiHd9yh Xy3EgcXUHqQuTkmXL6u1mtd7CsnmFv9VC49Y/F9XQFKYwTHOvXSFBwkHLyz2ZL49LLUN Lc+4oXBW+APm4gl24uitdYnywYvuYe3zAc09Rl3a/Ai44qKC1dsQY0FN1HEm+3vhsyp2 PBhkzMv75fgTiwXnDr1a0UxBE2zGMSSMw5YooEk3nLDXOKvkwpfmt0KPNxtK2iM3vSDh oMsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769780096; x=1770384896; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=lKvxKGZ/wM7it4bTsO0Z3rMS2mHTFWTEN2O02PyhYlQ=; b=IwXs04r1SjhOHtxhiC/7T+YaJHJQFq3nSMghEJJOszS940aWQxWSMg0cOXpZqZMPYZ Lk7ytDtv3b1Kh8RrnY6hNur5pI/kfx5zIuiWyU0jCjGHYtU/wTiWR0qLsHAewolexjeR 5OWRI72x4sePW8fpSABrz4cA7JU8QLNIveQIFWuHsMgPfp3AMe+vuSlQ/n9JC+wDEE6P bLNBdV+LD+0tvb88uaS3ireFXzKEY2FsdaUDsEzPe+D+ObufA2Kv1PSzh7qTArXwwyQo xHmm67ymK3lLq0DqnQMNk+w2Vu+g5a+v6KoAx+QIMmC0h6GhDSyRKgSnW4KXGk9MEILE CbFQ== X-Forwarded-Encrypted: i=1; AJvYcCXLrKCAdu8xMccCcVs4ndiuT7ieKIY1BKotnsnAduM5JK3cV1pmMbGXXREkApW6uGR+KLpJuAxXfTmHRag=@vger.kernel.org X-Gm-Message-State: AOJu0Yzlmsr345M5nCDPAkzEGPbiuSNA1/F3tYKRGAyY+wbl8/w5CDuh cO7+/9CgdVCBtvp/HYoBt6D7nV1ilrt60vxA9JONavS19kZhXx4elj1W X-Gm-Gg: AZuq6aLXFX0C4GgVIKpNbZILnoieuTsta+nLeu4oWig8F+U2ivTjHP9X618EZQGwFtl f/TX9GllNY/Vd48hqHGDZY2LAbsBoxGXXD+94UTrCH2BmnJxaOqo4StB5TRWLA7wlGYykWtc8Mp cC5fY5ahTPGkAhqC/iVgLMk9JgT5QNW5XPnf4fQDiTJi7VNtJvJnMFd7qP+KDsBni+LZnC7ojR8 DjPoaaRNEv/f2LB+mUSjsOIAVBLewXiSdZ7Zt1wCPeRe+zaK7gXGoPCIRH4ueXnzsDahQZvLWlm yJfEzewAmBNmsa5eiGAsZfASKzgJ+ETHq/XpUw0QqfcBmfabQB+w2qrTVBSB2wFF0giiegV/GfR /IcyPm/LL0C0JSEYh3gti17rOEW/ef4ygqXtGG5fuhBXBBg1KQ5Zq4QJbAblBl0Bhweniz926YX OC X-Received: by 2002:a05:6000:184d:b0:432:da3b:5941 with SMTP id ffacd0b85a97d-435f3a7b8camr4494369f8f.21.1769780096189; Fri, 30 Jan 2026 05:34:56 -0800 (PST) Received: from xeon ([188.163.112.49]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-435e131ce93sm21536837f8f.24.2026.01.30.05.34.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Jan 2026 05:34:55 -0800 (PST) From: Svyatoslav Ryhel To: Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Thierry Reding , Jonathan Hunter , Jaroslav Kysela , Takashi Iwai , Svyatoslav Ryhel , =?UTF-8?q?Jonas=20Schw=C3=B6bel?= Cc: linux-sound@vger.kernel.org, devicetree@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 4/4] ASoC: tegra: Support WM8962 by machine driver Date: Fri, 30 Jan 2026 15:34:34 +0200 Message-ID: <20260130133434.353353-5-clamor95@gmail.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260130133434.353353-1-clamor95@gmail.com> References: <20260130133434.353353-1-clamor95@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable From: Jonas Schw=C3=B6bel Add Wolfson Microelectronics WM8962 codec support to the Tegra ASoC machine driver. The WM8962 codec is found on devices like Microsoft Surface RT and Microsoft Surface 2 Windows RT based tablets. Co-developed-by: Svyatoslav Ryhel Signed-off-by: Svyatoslav Ryhel Signed-off-by: Jonas Schw=C3=B6bel --- sound/soc/tegra/Kconfig | 10 ++ sound/soc/tegra/Makefile | 2 + sound/soc/tegra/tegra_wm8962.c | 165 +++++++++++++++++++++++++++++++++ 3 files changed, 177 insertions(+) create mode 100644 sound/soc/tegra/tegra_wm8962.c diff --git a/sound/soc/tegra/Kconfig b/sound/soc/tegra/Kconfig index f9257830daa1..56a2f53df2c1 100644 --- a/sound/soc/tegra/Kconfig +++ b/sound/soc/tegra/Kconfig @@ -229,6 +229,16 @@ config SND_SOC_TEGRA_WM8903 boards using the WM8093 codec. Currently, the supported boards are Harmony, Ventana, Seaboard, Kaen, and Aebl. =20 +config SND_SOC_TEGRA_WM8962 + tristate "SoC Audio support for Tegra boards using a WM8962 codec" + depends on I2C && GPIOLIB + select SND_SOC_TEGRA_MACHINE_DRV + select SND_SOC_WM8962 + help + Say Y or M here if you want to add support for SoC audio on Tegra + boards using the WM8962 codec. Currently, the supported boards are + Microsoft Surface RT. + config SND_SOC_TEGRA_WM9712 tristate "SoC Audio support for Tegra boards using a WM9712 codec" depends on GPIOLIB diff --git a/sound/soc/tegra/Makefile b/sound/soc/tegra/Makefile index defea7f53f11..3f396c87802e 100644 --- a/sound/soc/tegra/Makefile +++ b/sound/soc/tegra/Makefile @@ -43,9 +43,11 @@ obj-$(CONFIG_SND_SOC_TEGRA210_OPE) +=3D snd-soc-tegra210= -ope.o =20 # Tegra machine Support snd-soc-tegra-wm8903-y :=3D tegra_wm8903.o +snd-soc-tegra-wm8962-y :=3D tegra_wm8962.o snd-soc-tegra-machine-y :=3D tegra_asoc_machine.o snd-soc-tegra-audio-graph-card-y :=3D tegra_audio_graph_card.o =20 obj-$(CONFIG_SND_SOC_TEGRA_WM8903) +=3D snd-soc-tegra-wm8903.o +obj-$(CONFIG_SND_SOC_TEGRA_WM8962) +=3D snd-soc-tegra-wm8962.o obj-$(CONFIG_SND_SOC_TEGRA_MACHINE_DRV) +=3D snd-soc-tegra-machine.o obj-$(CONFIG_SND_SOC_TEGRA_AUDIO_GRAPH_CARD) +=3D snd-soc-tegra-audio-grap= h-card.o diff --git a/sound/soc/tegra/tegra_wm8962.c b/sound/soc/tegra/tegra_wm8962.c new file mode 100644 index 000000000000..31f9d9181595 --- /dev/null +++ b/sound/soc/tegra/tegra_wm8962.c @@ -0,0 +1,165 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * tegra_wm8962.c - Tegra machine ASoC driver for boards using WM8962 code= c. + * + * Copyright (C) 2021-2024 Jonas Schw=C3=B6bel + * Svyatoslav Ryhel + * + * Based on tegra_wm8903 code copyright/by: + * + * Author: Stephen Warren + * Copyright (C) 2010-2012 - NVIDIA, Inc. + * + * Based on code copyright/by: + * + * (c) 2009, 2010 Nvidia Graphics Pvt. Ltd. + * + * Copyright 2007 Wolfson Microelectronics PLC. + * Author: Graeme Gregory + * graeme.gregory@wolfsonmicro.com or linux@wolfsonmicro.com + */ + +#include +#include +#include +#include + +#include +#include +#include + +#include "../codecs/wm8962.h" + +#include "tegra_asoc_machine.h" + +static struct snd_soc_jack_pin tegra_wm8962_mic_jack_pins[] =3D { + { .pin =3D "Mic Jack", .mask =3D SND_JACK_MICROPHONE }, +}; + +static unsigned int tegra_wm8962_mclk_rate(unsigned int srate) +{ + unsigned int mclk; + + switch (srate) { + case 8000: + case 16000: + case 24000: + case 32000: + case 48000: + case 64000: + case 96000: + mclk =3D 12288000; + break; + case 11025: + case 22050: + case 44100: + case 88200: + mclk =3D 11289600; + break; + default: + mclk =3D 12000000; + break; + } + + return mclk; +} + +static int tegra_wm8962_init(struct snd_soc_pcm_runtime *rtd) +{ + struct tegra_machine *machine =3D snd_soc_card_get_drvdata(rtd->card); + struct snd_soc_card *card =3D rtd->card; + struct snd_soc_dapm_context *dapm =3D snd_soc_card_to_dapm(card); + int err; + + err =3D tegra_asoc_machine_init(rtd); + if (err) + return err; + + if (!machine->gpiod_mic_det && machine->asoc->add_mic_jack) { + struct snd_soc_dai *codec_dai =3D snd_soc_rtd_to_codec(rtd, 0); + struct snd_soc_component *component =3D codec_dai->component; + + err =3D snd_soc_card_jack_new_pins(rtd->card, "Mic Jack", + SND_JACK_MICROPHONE, + machine->mic_jack, + tegra_wm8962_mic_jack_pins, + ARRAY_SIZE(tegra_wm8962_mic_jack_pins)); + if (err) { + dev_err(rtd->dev, "Mic Jack creation failed: %d\n", err); + return err; + } + + wm8962_mic_detect(component, machine->mic_jack); + } + + snd_soc_dapm_force_enable_pin(dapm, "MICBIAS"); + + return 0; +} + +static int tegra_wm8962_remove(struct snd_soc_card *card) +{ + struct snd_soc_dai_link *link =3D &card->dai_link[0]; + struct snd_soc_pcm_runtime *rtd =3D snd_soc_get_pcm_runtime(card, link); + struct snd_soc_dai *codec_dai =3D snd_soc_rtd_to_codec(rtd, 0); + struct snd_soc_component *component =3D codec_dai->component; + + wm8962_mic_detect(component, NULL); + + return 0; +} + +SND_SOC_DAILINK_DEFS(wm8962_hifi, + DAILINK_COMP_ARRAY(COMP_EMPTY()), + DAILINK_COMP_ARRAY(COMP_CODEC(NULL, "wm8962")), + DAILINK_COMP_ARRAY(COMP_EMPTY())); + +static struct snd_soc_dai_link tegra_wm8962_dai =3D { + .name =3D "WM8962", + .stream_name =3D "WM8962 PCM", + .init =3D tegra_wm8962_init, + .dai_fmt =3D SND_SOC_DAIFMT_I2S | + SND_SOC_DAIFMT_NB_NF | + SND_SOC_DAIFMT_CBC_CFC, + SND_SOC_DAILINK_REG(wm8962_hifi), +}; + +static struct snd_soc_card snd_soc_tegra_wm8962 =3D { + .components =3D "codec:wm8962", + .owner =3D THIS_MODULE, + .dai_link =3D &tegra_wm8962_dai, + .num_links =3D 1, + .remove =3D tegra_wm8962_remove, + .fully_routed =3D true, +}; + +static const struct tegra_asoc_data tegra_wm8962_data =3D { + .mclk_rate =3D tegra_wm8962_mclk_rate, + .card =3D &snd_soc_tegra_wm8962, + .add_common_dapm_widgets =3D true, + .add_common_controls =3D true, + .add_common_snd_ops =3D true, + .add_mic_jack =3D true, + .add_hp_jack =3D true, +}; + +static const struct of_device_id tegra_wm8962_of_match[] =3D { + { .compatible =3D "nvidia,tegra-audio-wm8962", .data =3D &tegra_wm8962_da= ta }, + {}, +}; +MODULE_DEVICE_TABLE(of, tegra_wm8962_of_match); + +static struct platform_driver tegra_wm8962_driver =3D { + .driver =3D { + .name =3D "tegra-wm8962", + .of_match_table =3D tegra_wm8962_of_match, + .pm =3D &snd_soc_pm_ops, + }, + .probe =3D tegra_asoc_machine_probe, +}; +module_platform_driver(tegra_wm8962_driver); + +MODULE_AUTHOR("Jonas Schw=C3=B6bel "); +MODULE_AUTHOR("Svyatoslav Ryhel "); +MODULE_DESCRIPTION("Tegra+WM8962 machine ASoC driver"); +MODULE_LICENSE("GPL"); --=20 2.51.0