From patchwork Mon Oct 21 13:46:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nuno Sa X-Patchwork-Id: 13844180 Received: from mx0a-00128a01.pphosted.com (mx0a-00128a01.pphosted.com [148.163.135.77]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AD3A01E0B96; Mon, 21 Oct 2024 13:43:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.135.77 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729518207; cv=none; b=LGlwmCTwcHJykIJYHn31vDvK570qxNI0JuhMFxOVkInmuDOR9aOdSBhL1mpWT+Xpj1IHjqdkYDAm5Tho2B0P328JYNvq/McbqDnHFI7MkjoIsvKxbUz4/H/NyNlUKbYMDngrAeao/I+CTE4PtpS2cD7689TdDT034iCD07lSxMs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729518207; c=relaxed/simple; bh=28ZEwNAS2wz8DuwwSFhc4diahqnZwjYWUf4dzSSUEw8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=h7CtsFaZ8xZ+aafU9rSp4W4eu90mMVXrn2a7x4uRcXuQteGe6h5p5h+uB50nLS5PgPh6oWANbQwjKUDx+kKUCG1EK+0k3dsz2z10AgJ+aiNxNrpBqWr6m/cVk/bF76LfE9mY5ol/5T8ZRvMMz3EIgeJiqq2U39leilHbk4D6DKs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=analog.com; spf=pass smtp.mailfrom=analog.com; dkim=pass (2048-bit key) header.d=analog.com header.i=@analog.com header.b=qxpf7no0; arc=none smtp.client-ip=148.163.135.77 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=analog.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=analog.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=analog.com header.i=@analog.com header.b="qxpf7no0" Received: from pps.filterd (m0167089.ppops.net [127.0.0.1]) by mx0a-00128a01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49LDS1lk019868; Mon, 21 Oct 2024 09:42:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=analog.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=DKIM; bh=NDWic yi3U6+Fr7U8T64rcjDoHTLIy2DHOYZyWUxvJ24=; b=qxpf7no0ZoAd8TJi5n1bz Pj50K4zcHGa7g07fbDqn6NyQGGtyOBp8WJUZkQCWoRZan1oYRPW+5kKZjuCLrDMh JBWEZcrgI1U4HCeeUNZHxmRnGP6mjp9X7oX3D53GW5u4viNMMW29D1+bCYgc4l5L dGaMhr/iMNIKT25y/frO6ADdPIhk0U2dyQrl01rN73q9/U0Z7Oq+L6WOb6mSj+T9 KYsG1lZhSujBeKROCkyF4oTooZfRYwtelJpVqbok++oGLFTI1NeDoPnk+j1I9jQC mkCB/xBWXeoadBINKpAvEVIEae/5h3T7aKPCGkIgjG5JwCKn4N/bXSB+dpvkfioh A== Received: from nwd2mta4.analog.com ([137.71.173.58]) by mx0a-00128a01.pphosted.com (PPS) with ESMTPS id 42dk5dh6q4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 21 Oct 2024 09:42:47 -0400 (EDT) Received: from ASHBMBX8.ad.analog.com (ASHBMBX8.ad.analog.com [10.64.17.5]) by nwd2mta4.analog.com (8.14.7/8.14.7) with ESMTP id 49LDgj5t038537 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 21 Oct 2024 09:42:45 -0400 Received: from ASHBMBX8.ad.analog.com (10.64.17.5) by ASHBMBX8.ad.analog.com (10.64.17.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.14; Mon, 21 Oct 2024 09:42:45 -0400 Received: from zeus.spd.analog.com (10.66.68.11) by ashbmbx8.ad.analog.com (10.64.17.5) with Microsoft SMTP Server id 15.2.986.14 via Frontend Transport; Mon, 21 Oct 2024 09:42:45 -0400 Received: from [127.0.0.1] ([10.44.3.60]) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 49LDgU7X017079; Mon, 21 Oct 2024 09:42:40 -0400 From: Nuno Sa Date: Mon, 21 Oct 2024 15:46:45 +0200 Subject: [PATCH 1/4] ASoC: codecs: adau1373: add some kconfig text Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20241021-adau1373-shutdown-v1-1-bec4ff9dfa16@analog.com> References: <20241021-adau1373-shutdown-v1-0-bec4ff9dfa16@analog.com> In-Reply-To: <20241021-adau1373-shutdown-v1-0-bec4ff9dfa16@analog.com> To: , CC: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Conor Dooley X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1729518408; l=690; i=nuno.sa@analog.com; s=20231116; h=from:subject:message-id; bh=28ZEwNAS2wz8DuwwSFhc4diahqnZwjYWUf4dzSSUEw8=; b=WWs6spQOo9a4U4sJVsdfc+361jxenLEKpEkx0HPb81NSc4AefMHwSVilMxB8upXM7XR/nYJ2O He2Ja5cRfscBWXAD2EWOX+yvC+pCuEjTA82LKER99XdUUxRi4LUz91a X-Developer-Key: i=nuno.sa@analog.com; a=ed25519; pk=3NQwYA013OUYZsmDFBf8rmyyr5iQlxV/9H4/Df83o1E= X-ADIRuleOP-NewSCL: Rule Triggered X-Proofpoint-ORIG-GUID: KWg7cdvOurh9ytSBjRu9YfJKFE08ibbS X-Proofpoint-GUID: KWg7cdvOurh9ytSBjRu9YfJKFE08ibbS X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=528 adultscore=0 spamscore=0 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 mlxscore=0 lowpriorityscore=0 priorityscore=1501 clxscore=1015 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2409260000 definitions=main-2410210097 Add some text to 'tristate' so that we can actually enable the driver when using things like menuconfig. Signed-off-by: Nuno Sa --- sound/soc/codecs/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig index 6a6125e94d2dc094b10c6f2fb53dd447e831f23d..72643907cef737ab4504ebac78b2bf7b4a8ead68 100644 --- a/sound/soc/codecs/Kconfig +++ b/sound/soc/codecs/Kconfig @@ -464,7 +464,7 @@ config SND_SOC_ADAU1372_SPI select REGMAP_SPI config SND_SOC_ADAU1373 - tristate + tristate "Analog Devices ADAU1373 CODEC" depends on I2C select SND_SOC_ADAU_UTILS From patchwork Mon Oct 21 13:46:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Nuno Sa X-Patchwork-Id: 13844179 Received: from mx0b-00128a01.pphosted.com (mx0a-00128a01.pphosted.com [148.163.135.77]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CA8171EF94D; Mon, 21 Oct 2024 13:43:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.135.77 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729518206; cv=none; b=q31C/rY14OrI7gyb3zLcuybjxnbyUiNhPxvG2cpUqF/CpFixF0IiT2+prcEG0Mqsv7uaQi/8pbum81O9bKeaWyzCoalgiLK3hiFv5+2baBVbSIPfiAk8ibVlR4s8bIuyHv9D9tlgu3rEs8E1gQJY3SxFMxnpN0wlttDdFkMcBmw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729518206; c=relaxed/simple; bh=K2clbhpui8Incij8sBp5YSICKBkxdYopSR8bCXqtJgE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=gkwGzO00n40YK5R2jF7TYTg5xEzwzy4nC0uyzoqAMHAjj62KD+XIbkYe65QcGUljwL2dndigoT9qL/uHyuBPexXPUWJTJ1G2sL136LfuJ8f0Ch74pLdkkQQM5Fx5OSKcP5FmQ6Jv7Um06IiumVYbwlGd1r33k7ZfZDRlT0Vl05Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=analog.com; spf=pass smtp.mailfrom=analog.com; dkim=pass (2048-bit key) header.d=analog.com header.i=@analog.com header.b=K2agTvZB; arc=none smtp.client-ip=148.163.135.77 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=analog.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=analog.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=analog.com header.i=@analog.com header.b="K2agTvZB" Received: from pps.filterd (m0375855.ppops.net [127.0.0.1]) by mx0b-00128a01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49LA68t2022150; Mon, 21 Oct 2024 09:42:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=analog.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=DKIM; bh=OxHY/ QtVSEZ3voaIOZX7qBVpj4NA4iMnNKP5dzM2M6U=; b=K2agTvZBDCh4xDeRKiNUW JHLUhSOcTeXYBWYXcl3VE3amgsIS+HZJVHNP4/gmJD+C6AYkpRYyY/1HV0qoATsM 76fuH2FhzTCB1xm6uOgsYxe/GLUj3FxBCkYmxmJwRFN8vjZUtlxnbvM2A16TB6xY 9tZkW1cCB46fVa0YOomkyDd2/Dnd4RdrNfwre8/GQ349vbalxJ73neV1RdiID5fQ YHStyENBBL1Jjuo1lMS9CpeDVrf9wJzvoX0bjF5tb8b/vXETGloG2wJNbAr037WF AVqvv08h73ierKo7Ld588373hEqbFbkAyShi3//ZblCCr5pwLHtNpJsVcpmhxOWO Q== Received: from nwd2mta3.analog.com ([137.71.173.56]) by mx0b-00128a01.pphosted.com (PPS) with ESMTPS id 42dmwhgsg6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 21 Oct 2024 09:42:47 -0400 (EDT) Received: from ASHBMBX9.ad.analog.com (ASHBMBX9.ad.analog.com [10.64.17.10]) by nwd2mta3.analog.com (8.14.7/8.14.7) with ESMTP id 49LDge6S055732 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 21 Oct 2024 09:42:45 -0400 Received: from ASHBMBX9.ad.analog.com (10.64.17.10) by ASHBMBX9.ad.analog.com (10.64.17.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.14; Mon, 21 Oct 2024 09:42:44 -0400 Received: from zeus.spd.analog.com (10.66.68.11) by ashbmbx9.ad.analog.com (10.64.17.10) with Microsoft SMTP Server id 15.2.986.14 via Frontend Transport; Mon, 21 Oct 2024 09:42:44 -0400 Received: from [127.0.0.1] ([10.44.3.60]) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 49LDgU7Y017079; Mon, 21 Oct 2024 09:42:41 -0400 From: Nuno Sa Date: Mon, 21 Oct 2024 15:46:46 +0200 Subject: [PATCH 2/4] ASoC: dt-bindings: document the adau1373 Codec Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20241021-adau1373-shutdown-v1-2-bec4ff9dfa16@analog.com> References: <20241021-adau1373-shutdown-v1-0-bec4ff9dfa16@analog.com> In-Reply-To: <20241021-adau1373-shutdown-v1-0-bec4ff9dfa16@analog.com> To: , CC: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Conor Dooley X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1729518408; l=3963; i=nuno.sa@analog.com; s=20231116; h=from:subject:message-id; bh=K2clbhpui8Incij8sBp5YSICKBkxdYopSR8bCXqtJgE=; b=I8VBbFUQCMyEvDtX7TWRsBI37JDyCpT9RcDKzFJtyoHTJrwxywexf0EEpbNXFhZT1gcp8afda SXBwNfzkJi9Aw2uoTiXPWhBzrCbQZ6jz5GuwU2iFftuo7EqttlGYReH X-Developer-Key: i=nuno.sa@analog.com; a=ed25519; pk=3NQwYA013OUYZsmDFBf8rmyyr5iQlxV/9H4/Df83o1E= X-ADIRuleOP-NewSCL: Rule Triggered X-Proofpoint-ORIG-GUID: riwVDiy9ACFdmUoQGsrVt7CzFXBf1Hy2 X-Proofpoint-GUID: riwVDiy9ACFdmUoQGsrVt7CzFXBf1Hy2 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 phishscore=0 mlxlogscore=999 priorityscore=1501 lowpriorityscore=0 clxscore=1011 adultscore=0 mlxscore=0 spamscore=0 bulkscore=0 suspectscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2409260000 definitions=main-2410210098 Describe the adau1373 Low Power Codec with Speaker and Headphone Amplifier. While at it, properly add a MAINTAINERS entry for ADI sound bindings. Signed-off-by: Nuno Sa --- .../devicetree/bindings/sound/adi,adau1373.yaml | 102 +++++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 103 insertions(+) diff --git a/Documentation/devicetree/bindings/sound/adi,adau1373.yaml b/Documentation/devicetree/bindings/sound/adi,adau1373.yaml new file mode 100644 index 0000000000000000000000000000000000000000..b2b5b2226ed7b354f2fb7871c17272b347921fa5 --- /dev/null +++ b/Documentation/devicetree/bindings/sound/adi,adau1373.yaml @@ -0,0 +1,102 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/sound/adi,adau1373.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + + +title: Analog Devices ADAU1373 CODEC + +maintainers: + - Nuno Sá + +description: | + Analog Devices ADAU1373 Low power codec with speaker and headphone amplifiers. + https://www.analog.com/media/en/technical-documentation/data-sheets/ADAU1373.pdf + +allOf: + - $ref: dai-common.yaml# + +properties: + compatible: + enum: + - adi,adau1373 + + reg: + maxItems: 1 + + "#sound-dai-cells": + const: 0 + + powerdown-gpios: + description: GPIO used for hardware power-down. + maxItems: 1 + + adi,micbias1-microvolt: + description: + This property sets the microphone bias voltage for the first microphone. + enum: [1800000, 2200000, 2600000, 2900000] + default: 2900000 + + adi,micbias2-microvolt: + description: + This property sets the microphone bias voltage for the second microphone. + enum: [1800000, 2200000, 2600000, 2900000] + default: 2900000 + + adi,input1-differential: + description: This property sets the first analog input as differential. + type: boolean + + adi,input2-differential: + description: This property sets the second analog input as differential. + type: boolean + + adi,input3-differential: + description: This property sets the third analog input as differential. + type: boolean + + adi,input4-differential: + description: This property sets the fourth analog input as differential. + type: boolean + + adi,lineout-differential: + description: This property sets the line output as differential. + type: boolean + + adi,lineout-gnd-sense: + description: This property enables the line output ground sense control. + type: boolean + + adi,drc-settings: + description: + This setting is used to control the dynamic range of the signal. The + device provides a maximum of three full band DRCs with 13 entries each. + $ref: /schemas/types.yaml#/definitions/uint8-array + oneOf: + - minItems: 13 + - minItems: 26 + - minItems: 39 + +required: + - "#sound-dai-cells" + - compatible + - reg + +unevaluatedProperties: false + +examples: + - | + #include + + i2c { + #address-cells = <1>; + #size-cells = <0>; + audio-codec@1a { + compatible = "adi,adau1373"; + reg = <0x1a>; + #sound-dai-cells = <0>; + powerdown-gpios = <&gpio 100 GPIO_ACTIVE_LOW>; + }; + }; +... diff --git a/MAINTAINERS b/MAINTAINERS index c1a2c296446c0724a0c6e70c845e5e5e1e693fd5..a3bf361f7b80774ae2228f2d71a3f477eb497ec5 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1521,6 +1521,7 @@ L: linux-sound@vger.kernel.org S: Supported W: http://wiki.analog.com/ W: https://ez.analog.com/linux-software-drivers +F: Documentation/devicetree/bindings/sound/adi,* F: sound/soc/codecs/ad1* F: sound/soc/codecs/ad7* F: sound/soc/codecs/adau* From patchwork Mon Oct 21 13:46:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nuno Sa X-Patchwork-Id: 13844181 Received: from mx0a-00128a01.pphosted.com (mx0a-00128a01.pphosted.com [148.163.135.77]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AD4071F80CF; Mon, 21 Oct 2024 13:43:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.135.77 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729518207; cv=none; b=lN3dS9+/4wKl0d5kF1OqFhzPlLqz3oV9sSk6ilER2IQXzw6DI16d9ENMCbBU5u1+RTEo8fGAGLuYOESLReqyM8AQ64/MgjK1O67V608YITSorDc9iIhb0JBKW4QQNjLkWO7LGzsh4cTsm6SnKzvE/RnEud0jGDAk4JSo9vKcgTU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729518207; c=relaxed/simple; bh=ZM9r7vED3kv7+r7g5A1zCEQS/Nl9bbZHXQAbshmVCyw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=JxPhHcKIVEs/MjEXaZFUwnQ2GBj3tx9HlZmPC0rOcsMqJsrLVc8cYk2Ul2joNC+6BD7fjo8G7sDTy2ng3uhq0ifcLGP8xCedpJaGgAaNeW9APKmJHieahhScnhgjm5l0Unia7I9507VLBuI/jBTImth0JEse4TjT+a+OZjeWrUQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=analog.com; spf=pass smtp.mailfrom=analog.com; dkim=pass (2048-bit key) header.d=analog.com header.i=@analog.com header.b=mgBT+U2L; arc=none smtp.client-ip=148.163.135.77 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=analog.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=analog.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=analog.com header.i=@analog.com header.b="mgBT+U2L" Received: from pps.filterd (m0167088.ppops.net [127.0.0.1]) by mx0a-00128a01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49LCG5sG015673; Mon, 21 Oct 2024 09:42:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=analog.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=DKIM; bh=GXsvn ihUVgxJj/G8aRNptGwZuVHWxQ6Dawe2pcOgaG0=; b=mgBT+U2LSevORfEeWVPeM n3MSmvB3M/HYhktiDlb6p9O3TzVVswX9ZRsDCR3aVmP7sAiip1xHoByBMcd41J8l QWyil3wlJzIkmYGRizzn0cqIunr7zB2tpig7Tpn90wbXQKQJRZNvSXQegdOIzhyU OkGBD8bte3hXFIy+39Me4hJmjDcCGZtg2ON0KAWk8lXhdjNmVycLBOFO8JDFVgSu h4nxu7EDWBoIijzAhR+5JSdkZMdHoxBZfLowudC0fepv9NSWUXJNQqxU4v+olRTZ 9F4USEm5MrGe0cN4tBCoBCG67p2Y3jrQmWsVQvafPUkfatTX32M164EHCxBzd6ox w== Received: from nwd2mta3.analog.com ([137.71.173.56]) by mx0a-00128a01.pphosted.com (PPS) with ESMTPS id 42dj4vsfrk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 21 Oct 2024 09:42:50 -0400 (EDT) Received: from ASHBMBX9.ad.analog.com (ASHBMBX9.ad.analog.com [10.64.17.10]) by nwd2mta3.analog.com (8.14.7/8.14.7) with ESMTP id 49LDgmID055746 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 21 Oct 2024 09:42:48 -0400 Received: from ASHBMBX9.ad.analog.com (10.64.17.10) by ASHBMBX9.ad.analog.com (10.64.17.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.14; Mon, 21 Oct 2024 09:42:48 -0400 Received: from zeus.spd.analog.com (10.66.68.11) by ashbmbx9.ad.analog.com (10.64.17.10) with Microsoft SMTP Server id 15.2.986.14 via Frontend Transport; Mon, 21 Oct 2024 09:42:48 -0400 Received: from [127.0.0.1] ([10.44.3.60]) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 49LDgU7Z017079; Mon, 21 Oct 2024 09:42:42 -0400 From: Nuno Sa Date: Mon, 21 Oct 2024 15:46:47 +0200 Subject: [PATCH 3/4] ASoC: codecs: adau1373: drop patform_data Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20241021-adau1373-shutdown-v1-3-bec4ff9dfa16@analog.com> References: <20241021-adau1373-shutdown-v1-0-bec4ff9dfa16@analog.com> In-Reply-To: <20241021-adau1373-shutdown-v1-0-bec4ff9dfa16@analog.com> To: , CC: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Conor Dooley X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1729518408; l=9151; i=nuno.sa@analog.com; s=20231116; h=from:subject:message-id; bh=ZM9r7vED3kv7+r7g5A1zCEQS/Nl9bbZHXQAbshmVCyw=; b=3BHf5LWbThwUzBjp+3yLRxvW74FmXan3osd3ahbN2kvS7hmbN7xG4I7OLGyvfeZfq9FWYD9z1 L6ZSRajfMBzB7CU7WMJDvcBpj8z6mLu9CgV3Yp/ye74XVr69XLtmihN X-Developer-Key: i=nuno.sa@analog.com; a=ed25519; pk=3NQwYA013OUYZsmDFBf8rmyyr5iQlxV/9H4/Df83o1E= X-ADIRuleOP-NewSCL: Rule Triggered X-Proofpoint-GUID: BZdBxaJvAbWCxBiRbMPdN-BU0PM2GgCO X-Proofpoint-ORIG-GUID: BZdBxaJvAbWCxBiRbMPdN-BU0PM2GgCO X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 impostorscore=0 phishscore=0 mlxscore=0 suspectscore=0 clxscore=1015 malwarescore=0 mlxlogscore=999 adultscore=0 spamscore=0 priorityscore=1501 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2409260000 definitions=main-2410210098 struct adau1373_platform_data" was not being used by any platform. Hence, drop it and move to firmware based support. All the configurations quirks present in the platform_data are now supported as firmware properties. Signed-off-by: Nuno Sa --- include/sound/adau1373.h | 33 -------- sound/soc/codecs/adau1373.c | 180 ++++++++++++++++++++++++++++++++------------ 2 files changed, 132 insertions(+), 81 deletions(-) diff --git a/include/sound/adau1373.h b/include/sound/adau1373.h deleted file mode 100644 index 4c32ba1328eda75f405047ce0f920791f348b98c..0000000000000000000000000000000000000000 --- a/include/sound/adau1373.h +++ /dev/null @@ -1,33 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later */ -/* - * Analog Devices ADAU1373 Audio Codec drive - * - * Copyright 2011 Analog Devices Inc. - * Author: Lars-Peter Clausen - */ - -#ifndef __SOUND_ADAU1373_H__ -#define __SOUND_ADAU1373_H__ - -enum adau1373_micbias_voltage { - ADAU1373_MICBIAS_2_9V = 0, - ADAU1373_MICBIAS_2_2V = 1, - ADAU1373_MICBIAS_2_6V = 2, - ADAU1373_MICBIAS_1_8V = 3, -}; - -#define ADAU1373_DRC_SIZE 13 - -struct adau1373_platform_data { - bool input_differential[4]; - bool lineout_differential; - bool lineout_ground_sense; - - unsigned int num_drc; - uint8_t drc_setting[3][ADAU1373_DRC_SIZE]; - - enum adau1373_micbias_voltage micbias1; - enum adau1373_micbias_voltage micbias2; -}; - -#endif diff --git a/sound/soc/codecs/adau1373.c b/sound/soc/codecs/adau1373.c index a910e252aa1265aa44fbd944f666a6f7ad16dc24..9568ff933e12ba939134a696c8d9c16a2ef04795 100644 --- a/sound/soc/codecs/adau1373.c +++ b/sound/soc/codecs/adau1373.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -18,7 +19,6 @@ #include #include #include -#include #include "adau1373.h" #include "adau-utils.h" @@ -30,9 +30,28 @@ struct adau1373_dai { bool clock_provider; }; +enum adau1373_micbias_voltage { + ADAU1373_MICBIAS_2_9V, + ADAU1373_MICBIAS_2_2V, + ADAU1373_MICBIAS_2_6V, + ADAU1373_MICBIAS_1_8V, +}; + +#define ADAU1373_DRC_SIZE 13 + struct adau1373 { struct regmap *regmap; struct adau1373_dai dais[3]; + + bool input_differential[4]; + bool lineout_differential; + bool lineout_ground_sense; + + unsigned int num_drc; + u8 drc_setting[3][ADAU1373_DRC_SIZE]; + + enum adau1373_micbias_voltage micbias1; + enum adau1373_micbias_voltage micbias2; }; #define ADAU1373_INPUT_MODE 0x00 @@ -1332,66 +1351,61 @@ static void adau1373_load_drc_settings(struct adau1373 *adau1373, regmap_write(adau1373->regmap, ADAU1373_DRC(nr) + i, drc[i]); } -static bool adau1373_valid_micbias(enum adau1373_micbias_voltage micbias) +static int adau1373_get_micbias(unsigned int val, + enum adau1373_micbias_voltage *micbias) { - switch (micbias) { - case ADAU1373_MICBIAS_2_9V: - case ADAU1373_MICBIAS_2_2V: - case ADAU1373_MICBIAS_2_6V: - case ADAU1373_MICBIAS_1_8V: - return true; + switch (val) { + case 2900000: + *micbias = ADAU1373_MICBIAS_2_9V; + return 0; + case 2200000: + *micbias = ADAU1373_MICBIAS_2_2V; + return 0; + case 2600000: + *micbias = ADAU1373_MICBIAS_2_6V; + return 0; + case 1800000: + *micbias = ADAU1373_MICBIAS_1_8V; + return 0; default: - break; + return -EINVAL; } - return false; } static int adau1373_probe(struct snd_soc_component *component) { struct adau1373 *adau1373 = snd_soc_component_get_drvdata(component); - struct adau1373_platform_data *pdata = component->dev->platform_data; - bool lineout_differential = false; unsigned int val; int i; - if (pdata) { - if (pdata->num_drc > ARRAY_SIZE(pdata->drc_setting)) - return -EINVAL; - - if (!adau1373_valid_micbias(pdata->micbias1) || - !adau1373_valid_micbias(pdata->micbias2)) - return -EINVAL; - - for (i = 0; i < pdata->num_drc; ++i) { - adau1373_load_drc_settings(adau1373, i, - pdata->drc_setting[i]); - } - - snd_soc_add_component_controls(component, adau1373_drc_controls, - pdata->num_drc); - - val = 0; - for (i = 0; i < 4; ++i) { - if (pdata->input_differential[i]) - val |= BIT(i); - } - regmap_write(adau1373->regmap, ADAU1373_INPUT_MODE, val); - - val = 0; - if (pdata->lineout_differential) - val |= ADAU1373_OUTPUT_CTRL_LDIFF; - if (pdata->lineout_ground_sense) - val |= ADAU1373_OUTPUT_CTRL_LNFBEN; - regmap_write(adau1373->regmap, ADAU1373_OUTPUT_CTRL, val); - - lineout_differential = pdata->lineout_differential; - - regmap_write(adau1373->regmap, ADAU1373_EP_CTRL, - (pdata->micbias1 << ADAU1373_EP_CTRL_MICBIAS1_OFFSET) | - (pdata->micbias2 << ADAU1373_EP_CTRL_MICBIAS2_OFFSET)); + for (i = 0; i < adau1373->num_drc; ++i) { + adau1373_load_drc_settings(adau1373, i, + adau1373->drc_setting[i]); } - if (!lineout_differential) { + snd_soc_add_component_controls(component, adau1373_drc_controls, + adau1373->num_drc); + + val = 0; + for (i = 0; i < ARRAY_SIZE(adau1373->input_differential); ++i) { + if (adau1373->input_differential[i]) + val |= BIT(i); + } + regmap_write(adau1373->regmap, ADAU1373_INPUT_MODE, val); + + val = 0; + if (adau1373->lineout_differential) + val |= ADAU1373_OUTPUT_CTRL_LDIFF; + if (adau1373->lineout_ground_sense) + val |= ADAU1373_OUTPUT_CTRL_LNFBEN; + + regmap_write(adau1373->regmap, ADAU1373_OUTPUT_CTRL, val); + + regmap_write(adau1373->regmap, ADAU1373_EP_CTRL, + (adau1373->micbias1 << ADAU1373_EP_CTRL_MICBIAS1_OFFSET) | + (adau1373->micbias2 << ADAU1373_EP_CTRL_MICBIAS2_OFFSET)); + + if (!adau1373->lineout_differential) { snd_soc_add_component_controls(component, adau1373_lineout2_controls, ARRAY_SIZE(adau1373_lineout2_controls)); } @@ -1471,6 +1485,65 @@ static const struct snd_soc_component_driver adau1373_component_driver = { .endianness = 1, }; +static int adau1373_parse_fw(struct device *dev, struct adau1373 *adau1373) +{ + int ret, drc_count; + unsigned int val; + + if (device_property_present(dev, "adi,input1-differential")) + adau1373->input_differential[0] = true; + if (device_property_present(dev, "adi,input2-differential")) + adau1373->input_differential[1] = true; + if (device_property_present(dev, "adi,input3-differential")) + adau1373->input_differential[2] = true; + if (device_property_present(dev, "adi,input4-differential")) + adau1373->input_differential[3] = true; + + if (device_property_present(dev, "adi,lineout-differential")) + adau1373->lineout_differential = true; + if (device_property_present(dev, "adi,lineout-gnd-sense")) + adau1373->lineout_ground_sense = true; + + ret = device_property_read_u32(dev, "adi,micbias1-microvolt", &val); + if (!ret) { + ret = adau1373_get_micbias(val, &adau1373->micbias1); + if (ret) + return dev_err_probe(dev, ret, + "Failed to get micbias1(%u)\n", val); + } + + ret = device_property_read_u32(dev, "adi,micbias2-microvolt", &val); + if (!ret) { + ret = adau1373_get_micbias(val, &adau1373->micbias2); + if (ret) + return dev_err_probe(dev, ret, + "Failed to get micbias2(%u)\n", val); + } + + drc_count = device_property_count_u8(dev, "adi,drc-settings"); + if (drc_count < 0) + return 0; + if (drc_count % ADAU1373_DRC_SIZE != 0) + return dev_err_probe(dev, -EINVAL, + "DRC count(%u) not multiple of %u\n", + drc_count, ADAU1373_DRC_SIZE); + + adau1373->num_drc = drc_count / ADAU1373_DRC_SIZE; + if (adau1373->num_drc > ARRAY_SIZE(adau1373->drc_setting)) + return dev_err_probe(dev, -EINVAL, + "Too many DRC settings(%u)\n", + adau1373->num_drc); + + ret = device_property_read_u8_array(dev, "adi,drc-settings", + (u8 *)&adau1373->drc_setting[0], + drc_count); + if (ret) + return dev_err_probe(dev, ret, + "Failed to read DRC settings\n"); + + return 0; +} + static int adau1373_i2c_probe(struct i2c_client *client) { struct adau1373 *adau1373; @@ -1489,6 +1562,10 @@ static int adau1373_i2c_probe(struct i2c_client *client) dev_set_drvdata(&client->dev, adau1373); + ret = adau1373_parse_fw(&client->dev, adau1373); + if (ret) + return ret; + ret = devm_snd_soc_register_component(&client->dev, &adau1373_component_driver, adau1373_dai_driver, ARRAY_SIZE(adau1373_dai_driver)); @@ -1501,9 +1578,16 @@ static const struct i2c_device_id adau1373_i2c_id[] = { }; MODULE_DEVICE_TABLE(i2c, adau1373_i2c_id); +static const struct of_device_id adau1373_of_match[] = { + { .compatible = "adi,adau1373", }, + { } +}; +MODULE_DEVICE_TABLE(of, adau1373_of_match); + static struct i2c_driver adau1373_i2c_driver = { .driver = { .name = "adau1373", + .of_match_table = adau1373_of_match, }, .probe = adau1373_i2c_probe, .id_table = adau1373_i2c_id, From patchwork Mon Oct 21 13:46:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nuno Sa X-Patchwork-Id: 13844178 Received: from mx0a-00128a01.pphosted.com (mx0a-00128a01.pphosted.com [148.163.135.77]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C26F31F76C1; Mon, 21 Oct 2024 13:43:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.135.77 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729518206; cv=none; b=UOW8lW9CVYQS1AJ8i627YkRnUrEZtJvpiSizg6v4d1aXrexUhsdQY0uyv+VKh1UmLKU63TEZKd4t3c770xr1CAeuegszuxgEc+BBlYoKd+LFdZqzYVy3wa5LwjELy/KT1BuIDGgu6/cGGeVwiawQIhGGQ7Iv+h5MYUJMZgkqn6w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729518206; c=relaxed/simple; bh=ji4xpsdauq4eL2UowXQVPh9V4Omji2HPbuJqCuXO3Lw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=GrtwIpmdEZaO0G41en7E4mQNhOSzoIFw3yNWug1fhfs1YAN69VJ3PERbV26a/gJWI2haw/SOsffUjJqnm0AB4QdUaZIyI4gQBJIPJoAkMiUwVn3RevBCNWk89voZIho68XLuIBr3vGnR91/4OPy8OY9n6QUg/547ssnObUa/nJk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=analog.com; spf=pass smtp.mailfrom=analog.com; dkim=pass (2048-bit key) header.d=analog.com header.i=@analog.com header.b=YoQrJlMf; arc=none smtp.client-ip=148.163.135.77 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=analog.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=analog.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=analog.com header.i=@analog.com header.b="YoQrJlMf" Received: from pps.filterd (m0167089.ppops.net [127.0.0.1]) by mx0a-00128a01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49LDYWoT019790; Mon, 21 Oct 2024 09:42:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=analog.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=DKIM; bh=xTTLu /OlHYE+6sDiudTP9ZXXxgkxjScBGiy6SuAyF/Q=; b=YoQrJlMfWOT9NNAVgLj0H p/oZ8WorUmSyBQECRyQdRNl9hgaPdRLPPQH/YsjpyWaIsiKzrG+3uUg7TplKYB3/ T8tUklUegImJppC0nRCtbRt6tr2N4x/zfB3dyQER1jkywpvDEcQ5UVgjx0aCzTcL k9dhNwNj1ML8CnSrUOgBUHL5SWDTqoRtQE4VBltqcE7TLGET5jjPtijfYBKoVMI5 UY30ulISrDHLttzuLPW9gtU53O4L7GajrrCrlDV5f0/MAXGMhKayZ62Bs9psQ66o Vdp5gp4R8/n2FyFFnQPfgLBwBMMhgFRrnpDt5BjZ/uXEpxzdptUcoByrX+V2ZudC g== Received: from nwd2mta4.analog.com ([137.71.173.58]) by mx0a-00128a01.pphosted.com (PPS) with ESMTPS id 42dk5dh6qb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 21 Oct 2024 09:42:51 -0400 (EDT) Received: from ASHBMBX8.ad.analog.com (ASHBMBX8.ad.analog.com [10.64.17.5]) by nwd2mta4.analog.com (8.14.7/8.14.7) with ESMTP id 49LDgnQu038540 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 21 Oct 2024 09:42:49 -0400 Received: from ASHBMBX8.ad.analog.com (10.64.17.5) by ASHBMBX8.ad.analog.com (10.64.17.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.14; Mon, 21 Oct 2024 09:42:49 -0400 Received: from zeus.spd.analog.com (10.66.68.11) by ashbmbx8.ad.analog.com (10.64.17.5) with Microsoft SMTP Server id 15.2.986.14 via Frontend Transport; Mon, 21 Oct 2024 09:42:49 -0400 Received: from [127.0.0.1] ([10.44.3.60]) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 49LDgU7a017079; Mon, 21 Oct 2024 09:42:44 -0400 From: Nuno Sa Date: Mon, 21 Oct 2024 15:46:48 +0200 Subject: [PATCH 4/4] ASoC: codecs: adau1373: add powerdown gpio Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20241021-adau1373-shutdown-v1-4-bec4ff9dfa16@analog.com> References: <20241021-adau1373-shutdown-v1-0-bec4ff9dfa16@analog.com> In-Reply-To: <20241021-adau1373-shutdown-v1-0-bec4ff9dfa16@analog.com> To: , CC: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Conor Dooley X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1729518408; l=1685; i=nuno.sa@analog.com; s=20231116; h=from:subject:message-id; bh=ji4xpsdauq4eL2UowXQVPh9V4Omji2HPbuJqCuXO3Lw=; b=JhxM6BIKcF/Mgy6Mj+vuyqltUcWqSun7Zep47ulNiBeY3w6OqtCWfgPVc12ohEyVtUbDVAC3C QM6n/vj+cUcCuqdXzGXANRvpzN/ig0ZTFdF1WW1zPPypm4bXSFKUZ71 X-Developer-Key: i=nuno.sa@analog.com; a=ed25519; pk=3NQwYA013OUYZsmDFBf8rmyyr5iQlxV/9H4/Df83o1E= X-ADIRuleOP-NewSCL: Rule Triggered X-Proofpoint-ORIG-GUID: pz9StNY-R34H6gsmw7V007FdOlc-zhiX X-Proofpoint-GUID: pz9StNY-R34H6gsmw7V007FdOlc-zhiX X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=778 adultscore=0 spamscore=0 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 mlxscore=0 lowpriorityscore=0 priorityscore=1501 clxscore=1015 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2409260000 definitions=main-2410210097 If the powerdown GPIO is specified, we use it for reset. Otherwise, fallback to a software reset. Signed-off-by: Nuno Sa --- sound/soc/codecs/adau1373.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/sound/soc/codecs/adau1373.c b/sound/soc/codecs/adau1373.c index 9568ff933e12ba939134a696c8d9c16a2ef04795..d5566b4c444f3a8be07cc17fbdbb5fee1b6442e9 100644 --- a/sound/soc/codecs/adau1373.c +++ b/sound/soc/codecs/adau1373.c @@ -8,6 +8,7 @@ #include #include +#include #include #include #include @@ -1547,6 +1548,7 @@ static int adau1373_parse_fw(struct device *dev, struct adau1373 *adau1373) static int adau1373_i2c_probe(struct i2c_client *client) { struct adau1373 *adau1373; + struct gpio_desc *gpiod; int ret; adau1373 = devm_kzalloc(&client->dev, sizeof(*adau1373), GFP_KERNEL); @@ -1558,7 +1560,21 @@ static int adau1373_i2c_probe(struct i2c_client *client) if (IS_ERR(adau1373->regmap)) return PTR_ERR(adau1373->regmap); - regmap_write(adau1373->regmap, ADAU1373_SOFT_RESET, 0x00); + /* + * If the powerdown GPIO is specified, we use it for reset. Otherwise + * a software reset is done. + */ + gpiod = devm_gpiod_get_optional(&client->dev, "powerdown", + GPIOD_OUT_HIGH); + if (IS_ERR(gpiod)) + return PTR_ERR(gpiod); + + if (gpiod) { + gpiod_set_value_cansleep(gpiod, 0); + fsleep(10); + } else { + regmap_write(adau1373->regmap, ADAU1373_SOFT_RESET, 0x00); + } dev_set_drvdata(&client->dev, adau1373);