From patchwork Fri Jun 7 10:00:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricard Wanderlof X-Patchwork-Id: 13689570 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2073.outbound.protection.outlook.com [40.107.21.73]) (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 646571649DD; Fri, 7 Jun 2024 10:01:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.21.73 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717754472; cv=fail; b=XF+YrTbF6q2uAfdZhB2V/DF3rsm+RZNwRILBHMtOajqqDiEJiUY21DNx+RtBqkv2n/lEFg2KmdufqOrtbsqMqLaEL7h9xc0FDbKL3b3TkSQM71DKxW4Ip1DcpJbVb1hHEzVWPvCGk3d8zOP61TOBCnNixvYpKd+hcvE+akWx7jI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717754472; c=relaxed/simple; bh=NBPgb+UzhQBw0u6G9zvmO5y8DRccv1kcnx1jDWil730=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=vDXnf69NuXCUPPVVEQg8Ygs3pDuKtHlf5O65plovdA0rKZtTKzQp7bcrgsed5pUA1yGeHSGmeI75nBnTr/2cd7DjtmEO/as4hG5Bsfmn9xEFQoD7Jw5Zm4gaWf99u4VFK7DCOfq1cS05Yv+cGAY951ChnKCnUHIABpCEVmiMf4I= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=axis.com; spf=pass smtp.mailfrom=axis.com; dkim=pass (1024-bit key) header.d=axis.com header.i=@axis.com header.b=VbJAeB0x; arc=fail smtp.client-ip=40.107.21.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=axis.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=axis.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=axis.com header.i=@axis.com header.b="VbJAeB0x" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aYxuwfaa/P2zI/ywT/cT2nFXb/3wjYVFjPV0TlT/VwyHuGCl7l+ZXLT3pRaPms+J5adp7MYQWZ1IxnzVQ10OYJ5KqkWbSsPIySJc/UhTmb+Tkmsgw69kki6zQDRQ37wTlXof2fvNln23XGh6W0coV+emOQW3/q4WRs1OHW2YeDsIYyxnZ2+zomjgORiZ5CYlftGK2xG6IeEd2C0uYlZ5L7UtT1TEYkuzu8FZYxRkN/4trBUz8My2rgpItqfwt3VgS+FxtZ+cn3bdpypEyRME0TV4BhVTmLgAjdoVVfihDncoXNLcp2baX25tklsAsD5RwJOx6S2IOTTrNQIHq90X/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ljACq7q5QlB36Xv7ftLTEUOSwlDdYX6pftqt9pRwxQ8=; b=Zo7jG9bp/XQBYOql5S3GOhSeGetBZbp2V8uYwPHdSrFo5qIw4UaxhKMrfKIsXJYmc3uvMwW27UcxLJ2W2knSA3jzmgo26+Fy3zjJUmkzeSq+Onw2gwEZgv1fSYUiR28p/cAeat1XYhGZfjje4au4Pr0fKmfL/KENAsVVmqgl9h6JkjfT8q8IA/FwEjn36Ldmw9Pi1tfmIMFf+68sEi5UCDvkxz7oKkdjH8sHsxjeGEK63FZCRmMV8P0rRJMu3UlMyrF1nPiDtyPMaxz59cBOuZ1PRHDfkLFcBBj4pEaAfHN3d+L35MTgNo5dwgQ6R+7yO9AbOrJEayvslDu/zKgm3Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 195.60.68.100) smtp.rcpttodomain=alsa-project.org smtp.mailfrom=axis.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=axis.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ljACq7q5QlB36Xv7ftLTEUOSwlDdYX6pftqt9pRwxQ8=; b=VbJAeB0xyYHxU4Xrbnkss3Nfmr4LRQ9FCi3/NQz27rZ2avxdzeiXnqgaTdjGC/OX6h7A4h3l4qeYMkj2WW6DnaDXembl/KnSDFMmb0++uaOMxg7GwogJlZS2PFbomrNHSW2doSD+Do0K/bpjcKDj1DxrQ1WM4Vy02qD0svLU5TA= Received: from AS9PR06CA0143.eurprd06.prod.outlook.com (2603:10a6:20b:467::20) by GVXPR02MB8280.eurprd02.prod.outlook.com (2603:10a6:150:6d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.24; Fri, 7 Jun 2024 10:00:58 +0000 Received: from AMS0EPF00000195.eurprd05.prod.outlook.com (2603:10a6:20b:467:cafe::e0) by AS9PR06CA0143.outlook.office365.com (2603:10a6:20b:467::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7656.16 via Frontend Transport; Fri, 7 Jun 2024 10:00:58 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 195.60.68.100) smtp.mailfrom=axis.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=axis.com; Received-SPF: Pass (protection.outlook.com: domain of axis.com designates 195.60.68.100 as permitted sender) receiver=protection.outlook.com; client-ip=195.60.68.100; helo=mail.axis.com; pr=C Received: from mail.axis.com (195.60.68.100) by AMS0EPF00000195.mail.protection.outlook.com (10.167.16.215) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7633.15 via Frontend Transport; Fri, 7 Jun 2024 10:00:58 +0000 Received: from se-mail02w.axis.com (10.20.40.8) by se-mail01w.axis.com (10.20.40.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 7 Jun 2024 12:00:55 +0200 Received: from se-intmail01x.se.axis.com (10.0.5.60) by se-mail02w.axis.com (10.20.40.8) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Fri, 7 Jun 2024 12:00:55 +0200 Received: from pc49102-2217.se.axis.com (pc49102-2217.se.axis.com [10.88.7.5]) by se-intmail01x.se.axis.com (Postfix) with ESMTP id DAEB13340; Fri, 7 Jun 2024 12:00:55 +0200 (CEST) Received: by pc49102-2217.se.axis.com (Postfix, from userid 9470) id D54EA6476FDB; Fri, 7 Jun 2024 12:00:55 +0200 (CEST) From: Ricard Wanderlof Date: Fri, 7 Jun 2024 12:00:45 +0200 Subject: [PATCH v2 1/2] ASoC: dt-bindings: tlv320adc3xxx: Add MICBIAS-as-GPO properties Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240607-tlv320adc3xxx-micbias-gpo-v2-1-b140a45ffffe@axis.com> References: <20240607-tlv320adc3xxx-micbias-gpo-v2-0-b140a45ffffe@axis.com> In-Reply-To: <20240607-tlv320adc3xxx-micbias-gpo-v2-0-b140a45ffffe@axis.com> To: Mark Brown , Liam Girdwood , Shenghao Ding , Kevin Lu , Baojun Xu , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Ricard Wanderlof , Jaroslav Kysela , Takashi Iwai CC: , , , , "Ricard Wanderlof" , X-Mailer: b4 0.13.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AMS0EPF00000195:EE_|GVXPR02MB8280:EE_ X-MS-Office365-Filtering-Correlation-Id: 7df3793d-0d6a-421b-1396-08dc86d8baea X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|82310400017|1800799015|376005|7416005|36860700004|921011; X-Microsoft-Antispam-Message-Info: =?utf-8?q?WnG93PjwCAjEBuO1qCg+HECThvqBd4E?= =?utf-8?q?oyaO/cIzPAMPrFPw7y8s/LmjwhbLbZfLSMzPjzoK72+etL4P1Q8bkflsj3kEu5ihL?= =?utf-8?q?/vSoGiLsHqAMwSaIg5bDGZV2utducXK8iGdUffjj34IQ+kcTyUMF7mGwI7FrVgN8r?= =?utf-8?q?DTsn6Qlte22fJcAkfQTvdqGPR2EAyFAAf13+DA2Rex4mEvQNzFREnQPQsjnOkMwlh?= =?utf-8?q?AQpT0CvKD15MjNrdM7Wx9oUE9ONIMNpOwCcxO1rIBUep7clAv6oE1RO4wsaoCxfMB?= =?utf-8?q?M6vTJ3AW3NnNTU8WFnIVh9oUBYdnUEcoHeqUrrl+jxgRFDEdIKeh5HFbFe0IvBjLt?= =?utf-8?q?YTquXc1tCOUrh+Sf8pWCeNiGXcqdr4jW3QipreKnZwvlNGW7XEh7eWqmOE3ZeyzOR?= =?utf-8?q?cmV30WclEImA5u6V92dFuwk6/XAjpTuLbDghzR6p7jRSUjBhqeo2BO9oq8Uv014f5?= =?utf-8?q?E3wdUHyIRut3t8TdFJb3LL1xqHlBFG+jNO7PioR4aE8c+Z0V5VIRbC5gvv3m1ymmC?= =?utf-8?q?xqWdCPAOW6R+Pvh9fi0CtGYjtsbGKMzSGRuW0MDJiCx8N+/PkAb0ErjsUT0H7fKOg?= =?utf-8?q?J/sLhlkSTUT/x7DemV/UJ5yyNSGebh5fgOCwkxhoilRJS3iyQSJ9Pj0VzdFIXpURJ?= =?utf-8?q?SCBzSsvvWHqhRB5RIbRD2PaOTMsjdUP4q7VlGy2erImlyXUy57btcxKHhVG8bmJ2Y?= =?utf-8?q?US52XMURX6HWm5tdrsSGAaOe2QgUpT5lEjAakLnYNx7/wHoOHwdmR+PqmTKvTj86T?= =?utf-8?q?Mte9tcCW+CJ9aSV20F0hdnRwwuDeMpzkIjHz/rce5R8KCjlH+1Jx73zuXLd7rv/53?= =?utf-8?q?Jyi1JnYrOcolOPTDZxUsJbEkRrTdV2qlNKEyyJ+zO16c406LVMB9HOTEyOoNRMQuH?= =?utf-8?q?o/s+lYZ09MtkNRifD6Q8rc1uMaefe4Z0wXnviDQWFerpx2qRRsoGGLc/ICLVO6Lf0?= =?utf-8?q?dbjyCFl4538Jgvj2fyY86tVxsJFU2SgskxrchKDr6uuc9gdF2NFpCThWwKUmAslgf?= =?utf-8?q?pheYzxW8NUrjgKcRfgfr+aPYr+fpcr3yde6DnL4VLiLA/fAJcID4Ghgys3cj7H4dt?= =?utf-8?q?rz6uOUosZqZ2xB19EwnJS/0JiM6tAplmRSTru4LHmmbgsS5qZ+tdUJs1dVyKzciBZ?= =?utf-8?q?9OMQ4xe6pKcRlL7NCvP5y3ET7P00tfE9c/rjmM0A3d230z1/3zFxqD+M+7HL95rwA?= =?utf-8?q?j2RlOQWNErqX0Nt3Nbglvg/DFfAjkXCBOVXG9+duiopFQ6ffyolutU9FBgjQG13mK?= =?utf-8?q?QGGD99aBKvBRVFKJDql30EbKidNV0OLswILHhDLsLIZ63MPGKA0h75PlkXDrj2xm8?= =?utf-8?q?xFPJ+YGSOJ36nEqxcORq5kfYLSeLTYRBfPmhcgAKHqqseJF+MBYw4a8=3D?= X-Forefront-Antispam-Report: CIP:195.60.68.100;CTRY:SE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.axis.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(82310400017)(1800799015)(376005)(7416005)(36860700004)(921011);DIR:OUT;SFP:1101; X-OriginatorOrg: axis.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2024 10:00:58.6259 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7df3793d-0d6a-421b-1396-08dc86d8baea X-MS-Exchange-CrossTenant-Id: 78703d3c-b907-432f-b066-88f7af9ca3af X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=78703d3c-b907-432f-b066-88f7af9ca3af;Ip=[195.60.68.100];Helo=[mail.axis.com] X-MS-Exchange-CrossTenant-AuthSource: AMS0EPF00000195.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: GVXPR02MB8280 Add properties for configuring the MICBIAS pins as general purpose outputs, with some limitations: The voltage on the pin when activated may be set using another property to 2.0 V, 2.5 V or AVDD. When deactivated the pin will float. Signed-off-by: Ricard Wanderlof --- .../bindings/sound/ti,tlv320adc3xxx.yaml | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Documentation/devicetree/bindings/sound/ti,tlv320adc3xxx.yaml b/Documentation/devicetree/bindings/sound/ti,tlv320adc3xxx.yaml index ede14ca2c07a..b7cae1c65e84 100644 --- a/Documentation/devicetree/bindings/sound/ti,tlv320adc3xxx.yaml +++ b/Documentation/devicetree/bindings/sound/ti,tlv320adc3xxx.yaml @@ -82,6 +82,26 @@ properties: Note that there is currently no support for reading the GPIO pins as inputs. + ti,micbias1-gpo: + type: boolean + description: | + When set, the MICBIAS1 pin may be controlled via the GPIO framework, + as pin number 3 on the device. + + In this mode, when the pin is activated, it will be set to the voltage + specified by the ti,micbias1-vg property. When deactivated, the pin will + float. + + ti,micbias2-gpo: + type: boolean + description: | + When set, the MICBIAS2 pin may be controlled via the GPIO framework, + as pin number 4 on the device. + + In this mode, when the pin is activated, it will be set to the voltage + specified by the ti,micbias2-vg property. When deactivated, the pin will + float. + ti,micbias1-vg: $ref: /schemas/types.yaml#/definitions/uint32 enum: @@ -104,6 +124,10 @@ properties: description: | Mic bias voltage output on MICBIAS2 pin +dependencies: + ti,micbias1-gpio: [ti,micbias1-vg] + ti,micbias2-gpio: [ti,micbias2-vg] + required: - compatible - reg From patchwork Fri Jun 7 10:00:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricard Wanderlof X-Patchwork-Id: 13689569 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2047.outbound.protection.outlook.com [40.107.105.47]) (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 B453515F30D; Fri, 7 Jun 2024 10:01:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.105.47 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717754464; cv=fail; b=CjZmgMMY3E8/9KUIkJNkmxpqph2H3PbUK+AMX5no5tB5T9fs7VFvBfTsxyBK1B/qu6AldMr/VB/VuBnN5PQ7Iagr9rudrafx2RtbWvkzzq+vzhI+AH3DaS5CjissIeK2BTEz3J5rRWFN9KX2Sq4wKA1/DJ08/OjkfD7I6CpH5cg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717754464; c=relaxed/simple; bh=2ETKfb8VK13PTpYLFe3lnJNuwIXowCxaZWOea5Pv7io=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=ZS1pjL1uDpSthBwjY3wCmFOnAFjnw7E0tf5/L/C85KVzUMSJjs/3x4QYcNF5wEEe9rguw002cLwnEVNsFNHWoigaNRiGnbKNhu6oSVN2LwyJSRhkTYLjKB/MNhVeWo/i49M0MuywZ6qzA2ihHLx8zdNxvkOIfD7pJl72D8cx/z8= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=axis.com; spf=pass smtp.mailfrom=axis.com; dkim=pass (1024-bit key) header.d=axis.com header.i=@axis.com header.b=roTqp7YB; arc=fail smtp.client-ip=40.107.105.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=axis.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=axis.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=axis.com header.i=@axis.com header.b="roTqp7YB" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KW4s/o1dK9+1Sply5NjHK8/xNHLSQXxzioB1DyXN23aBRoCkEQp/UWVYI0R0x3+9G6+DcUgsSFoH5kWSUnfa5obji1T8KmYe/lkXE6O3RFfg9AyTJaxB89YxYSy3ZY6GDFL5Ldot76Idb7ko08hayPbJ0AI+bXkH7qTZ+ck0XvYn0K98RZ8IRSlxMWPMDE7+6F0yLOIpZ7Z9+NB8QSPmDhC6tu8HAte25e0FFG9hjGCZhaNu25K0LdLAjuCMrDh4kbqXD7L/QKV6S7zeLusmCHhJFULZYJEPveGV5+Mpl6ONBZljeNCmTp6A5gGyOj9CU9XnFXrKif2XOTG4XnPmhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=g1ZWXcyDO3jwG8kkAMerrUqvg4yIbozd2NQHtmO25kY=; b=BpAYKNLMHBeFZzGtdeO5klOne34KpMacY9A7GQvCWNR7YFnNE+4zJRUFzqZ1mAzmAnIm5Ije4+K1M6Cpo7woR7PnlmWaAvcQ3MP9FpFxo/aPjWZiwUN9aWGC5wXK1W0QvOV6st0YuYFUub/ZegW0phInNxq+nPNufJevnDOIWB1NFyTxud6Y01izzdk8WKWkT+uf9VVvbimztc1tVbPUcadHacyijsWaQHWrxiYGyhh51ZFzKdgLkDbJbApx0o1wG/P9Z+BxlkBYHOC+JfJfyXOa2w+jaLnfthxUYXsXj9QAxqr5mrY4aCGvRv2o0JQQJ1sqabjc78N3p5Wf7MxgNA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 195.60.68.100) smtp.rcpttodomain=alsa-project.org smtp.mailfrom=axis.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=axis.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=g1ZWXcyDO3jwG8kkAMerrUqvg4yIbozd2NQHtmO25kY=; b=roTqp7YB2Jz+2DUX+vlnRMdqasHyLnrz4yeaS8gl37mbrKT5IEQFcHubTsB5qcVZltEf6LMmJg25enhhVn6A5MrZwTWPAAlZqgRDjiM0Rg0tYWPUjbjshHmB6mH1baDOdZV/b/d55WEifHE2PPFidfN1Ka0b5O88xA45jtIUy3Y= Received: from AS9PR06CA0147.eurprd06.prod.outlook.com (2603:10a6:20b:467::19) by DBAPR02MB6152.eurprd02.prod.outlook.com (2603:10a6:10:18b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.34; Fri, 7 Jun 2024 10:00:56 +0000 Received: from AMS0EPF00000195.eurprd05.prod.outlook.com (2603:10a6:20b:467:cafe::ab) by AS9PR06CA0147.outlook.office365.com (2603:10a6:20b:467::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7656.18 via Frontend Transport; Fri, 7 Jun 2024 10:00:56 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 195.60.68.100) smtp.mailfrom=axis.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=axis.com; Received-SPF: Pass (protection.outlook.com: domain of axis.com designates 195.60.68.100 as permitted sender) receiver=protection.outlook.com; client-ip=195.60.68.100; helo=mail.axis.com; pr=C Received: from mail.axis.com (195.60.68.100) by AMS0EPF00000195.mail.protection.outlook.com (10.167.16.215) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7633.15 via Frontend Transport; Fri, 7 Jun 2024 10:00:56 +0000 Received: from se-mail02w.axis.com (10.20.40.8) by se-mail01w.axis.com (10.20.40.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 7 Jun 2024 12:00:55 +0200 Received: from se-intmail01x.se.axis.com (10.0.5.60) by se-mail02w.axis.com (10.20.40.8) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Fri, 7 Jun 2024 12:00:55 +0200 Received: from pc49102-2217.se.axis.com (pc49102-2217.se.axis.com [10.88.7.5]) by se-intmail01x.se.axis.com (Postfix) with ESMTP id DD2A93349; Fri, 7 Jun 2024 12:00:55 +0200 (CEST) Received: by pc49102-2217.se.axis.com (Postfix, from userid 9470) id D74706476FDE; Fri, 7 Jun 2024 12:00:55 +0200 (CEST) From: Ricard Wanderlof Date: Fri, 7 Jun 2024 12:00:46 +0200 Subject: [PATCH v2 2/2] tlv320adc3xxx: Add support for using MICBIAS pins as GPO Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240607-tlv320adc3xxx-micbias-gpo-v2-2-b140a45ffffe@axis.com> References: <20240607-tlv320adc3xxx-micbias-gpo-v2-0-b140a45ffffe@axis.com> In-Reply-To: <20240607-tlv320adc3xxx-micbias-gpo-v2-0-b140a45ffffe@axis.com> To: Mark Brown , Liam Girdwood , Shenghao Ding , Kevin Lu , Baojun Xu , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Ricard Wanderlof , Jaroslav Kysela , Takashi Iwai CC: , , , , "Ricard Wanderlof" , X-Mailer: b4 0.13.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AMS0EPF00000195:EE_|DBAPR02MB6152:EE_ X-MS-Office365-Filtering-Correlation-Id: 4cac7c60-98e5-44a9-d4d1-08dc86d8b986 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|36860700004|376005|82310400017|7416005|1800799015|921011; X-Microsoft-Antispam-Message-Info: =?utf-8?q?cI8YeC2wiwLFWXFxYGEHftMLgZmcbT3?= =?utf-8?q?jjgEq62kAJOMX2nMGfMNh/eWNG0Ash7bBQsuYFDws9QZFtFSWWZylchg2FuiW4VXZ?= =?utf-8?q?ZsVOVh18pX6Vbz76KFz9CMfA075DQvuno4mkCi3lcPFevR05k3lt9igThg2/erEXL?= =?utf-8?q?/Rn+noSz5oFwjujxsEBTz4BLiGyk+2tONCkSVZjnDrGFEfrgHRfbNCEJS+pU8hQfl?= =?utf-8?q?167l/wYU1qsIncl6Wun/l2LqZlQeDMs4pRc0gv5cip+lTjOHEG8xK6UzXdesLVtI9?= =?utf-8?q?N1Yo8cTfASv2YRcHYr7AOi86nJWNmV/brZxwKQKcigags+4tsxMJ10ydVKB2v71tk?= =?utf-8?q?Bn6mRHHW4VCaYyElwetX04H9wOZ3hYhzh2eH2g0rH3DVb1lNTCXqSKzaCU97EiH+b?= =?utf-8?q?0v2YKU5lCpGfPVW2aZWfQOIMJMRXQQCxtuhGhmZdy95g7qQtcwh5Yy815IHah4MFp?= =?utf-8?q?2zrEXcQ+gYrHPyQGQLzGlZgHXU8DvRConrL3zY+S4zQkM6FAyMQ4WC2ZLj/z6QFPi?= =?utf-8?q?j0KvvLwuqgRxC8PFfiS/CXXdSWVxE3EKkZObd9rh0uXa+uwfYmqgkt3TW7v0I/Aaw?= =?utf-8?q?cco0iqDD6/inVJK9Bgx+Igxywz9Lt11RT73QR8I62lINQYcQkR7sWmfWUR1oa91wU?= =?utf-8?q?PM6os8Y7YtouAFqmrkrJsAHqCDPdGeF6V6zNWQTqfa807W66Vm7ccCRa15f0i5mcm?= =?utf-8?q?OMrg5+mmL4Bm9hL+IBw/usEgDYZdUbuWENDzfHneAR6NiHOdnaVSHo77/KwnZ93ni?= =?utf-8?q?ONuGhUEC/uhYs1O7ibTKJBB0mxDrVujBtnbvEOzxR+okmSUeXE/lfdiieLWWraFaY?= =?utf-8?q?JYzy6jTR7rTWkXnCpgK4SdYNtRL9iiPS4BYHAqdcBJwwio3IJqhHA6t/5HMGzlcix?= =?utf-8?q?rdO+r6dNjMpimalMFeae26w+Xr/kgIi/KqDwyvt4u52tWeb+PYck6/x6DpUAtjA2Z?= =?utf-8?q?r1MyS1C8ysQbWoEZyDDaKLLhLrpvU5uLtDjqgUEenhLXgxldjxUH98mPIqzKE65Cu?= =?utf-8?q?ea+sU9dQDTb+1bQPDXo906Rj8hAbEZfD+muNql5sYvw7obhx5Dk9+2kDkFfsmsV+7?= =?utf-8?q?F0ZffM4Z0D+jiMocO8gtA2LEGDUCm5DvvWEo3C+UwEZUNBzL0/nWBGn6X/MspedzF?= =?utf-8?q?Fqdt/2QNLpehxx1s87J9x6Ev8MpITL4fwBVrFaPr2BDJg64YIj651CfHAKThE+AsU?= =?utf-8?q?VOWSoYHPjoj5DUnrYGcz9Bn1Kxp5HpPo3P34AxD1YMfcmtGR5T0pSHFrt7i5x+d2P?= =?utf-8?q?RvlE/r6Xu9b/XOmbik3QzFQbfAA5uiW8u3DkGhk8pA4CwDS/tWrnp5glukN2Oo5jp?= =?utf-8?q?/uRvCDhuL0AQZhTDOGHF+T6tIidFQiemIkPEet84+GtvlJ6X8zcGceM=3D?= X-Forefront-Antispam-Report: CIP:195.60.68.100;CTRY:SE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.axis.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(36860700004)(376005)(82310400017)(7416005)(1800799015)(921011);DIR:OUT;SFP:1101; X-OriginatorOrg: axis.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2024 10:00:56.3134 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4cac7c60-98e5-44a9-d4d1-08dc86d8b986 X-MS-Exchange-CrossTenant-Id: 78703d3c-b907-432f-b066-88f7af9ca3af X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=78703d3c-b907-432f-b066-88f7af9ca3af;Ip=[195.60.68.100];Helo=[mail.axis.com] X-MS-Exchange-CrossTenant-AuthSource: AMS0EPF00000195.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR02MB6152 Add boolean ti,micbias1-gpo and ti,micbias2-gpo devicetree properties. When set, the respective MICBIAS pins can be used as general purpose outputs controlled via the GPIO framework, in addition to the two configurable GPIO pins. This is useful in applications where the MICBIAS functionality is not required, but it is useful to have a couple of extra GPIO pins. The voltage on the respective MICBIAS pin in the active state is governed by the ti,micbias1-vg and ti,micbias2-vg properties, respectively (same properties as when the pins are used as MICBIAS pins). Signed-off-by: Ricard Wanderlof --- sound/soc/codecs/tlv320adc3xxx.c | 105 +++++++++++++++++++++++++++++++-------- 1 file changed, 84 insertions(+), 21 deletions(-) diff --git a/sound/soc/codecs/tlv320adc3xxx.c b/sound/soc/codecs/tlv320adc3xxx.c index e100cc9f5c19..182955bccebc 100644 --- a/sound/soc/codecs/tlv320adc3xxx.c +++ b/sound/soc/codecs/tlv320adc3xxx.c @@ -40,9 +40,10 @@ */ #define ADC3XXX_MICBIAS_PINS 2 +#define ADC3XXX_GPIO_PINS 2 /* Number of GPIO pins exposed via the gpiolib interface */ -#define ADC3XXX_GPIOS_MAX 2 +#define ADC3XXX_GPIOS_MAX (ADC3XXX_MICBIAS_PINS + ADC3XXX_GPIO_PINS) #define ADC3XXX_RATES SNDRV_PCM_RATE_8000_96000 #define ADC3XXX_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | \ @@ -321,7 +322,8 @@ struct adc3xxx { struct gpio_desc *rst_pin; unsigned int pll_mode; unsigned int sysclk; - unsigned int gpio_cfg[ADC3XXX_GPIOS_MAX]; /* value+1 (0 => not set) */ + unsigned int gpio_cfg[ADC3XXX_GPIO_PINS]; /* value+1 (0 => not set) */ + unsigned int micbias_gpo[ADC3XXX_MICBIAS_PINS]; /* 1 => pin is GPO */ unsigned int micbias_vg[ADC3XXX_MICBIAS_PINS]; int master; u8 page_no; @@ -329,7 +331,7 @@ struct adc3xxx { struct gpio_chip gpio_chip; }; -static const unsigned int adc3xxx_gpio_ctrl_reg[ADC3XXX_GPIOS_MAX] = { +static const unsigned int adc3xxx_gpio_ctrl_reg[ADC3XXX_GPIO_PINS] = { ADC3XXX_GPIO1_CTRL, ADC3XXX_GPIO2_CTRL }; @@ -960,14 +962,23 @@ static int adc3xxx_gpio_request(struct gpio_chip *chip, unsigned int offset) if (offset >= ADC3XXX_GPIOS_MAX) return -EINVAL; - /* GPIO1 is offset 0, GPIO2 is offset 1 */ - /* We check here that the GPIO pins are either not configured in the - * DT, or that they purposely are set as outputs. - * (Input mode not yet implemented). - */ - if (adc3xxx->gpio_cfg[offset] != 0 && - adc3xxx->gpio_cfg[offset] != ADC3XXX_GPIO_GPO + 1) - return -EINVAL; + if (offset >= 0 && offset < ADC3XXX_GPIO_PINS) { + /* GPIO1 is offset 0, GPIO2 is offset 1 */ + /* We check here that the GPIO pins are either not configured + * in the DT, or that they purposely are set as outputs. + * (Input mode not yet implemented). + */ + if (adc3xxx->gpio_cfg[offset] != 0 && + adc3xxx->gpio_cfg[offset] != ADC3XXX_GPIO_GPO + 1) + return -EINVAL; + } else if (offset >= ADC3XXX_GPIO_PINS && offset < ADC3XXX_GPIOS_MAX) { + /* MICBIAS1 is offset 2, MICBIAS2 is offset 3 */ + /* We check here if the MICBIAS pins are in fact configured + * as GPOs. + */ + if (!adc3xxx->micbias_gpo[offset - ADC3XXX_GPIO_PINS]) + return -EINVAL; + } return 0; } @@ -977,6 +988,21 @@ static int adc3xxx_gpio_direction_out(struct gpio_chip *chip, { struct adc3xxx *adc3xxx = gpiochip_get_data(chip); + /* For the MICBIAS pins, they are by definition outputs. */ + if (offset >= ADC3XXX_GPIO_PINS) { + unsigned int vg; + unsigned int micbias = offset - ADC3XXX_GPIO_PINS; + + if (value) + vg = adc3xxx->micbias_vg[micbias]; + else + vg = ADC3XXX_MICBIAS_OFF; + return regmap_update_bits(adc3xxx->regmap, + ADC3XXX_MICBIAS_CTRL, + ADC3XXX_MICBIAS_MASK << adc3xxx_micbias_shift[micbias], + vg << adc3xxx_micbias_shift[micbias]); + } + /* Set GPIO output function. */ return regmap_update_bits(adc3xxx->regmap, adc3xxx_gpio_ctrl_reg[offset], @@ -1005,9 +1031,17 @@ static int adc3xxx_gpio_get(struct gpio_chip *chip, unsigned int offset) unsigned int regval; int ret; - /* We only allow output pins, so just read the value set in the output - * pin register field. - */ + /* We only allow output pins, so just read the value prevously set. */ + if (offset >= ADC3XXX_GPIO_PINS) { + /* MICBIAS pins */ + unsigned int micbias = offset - ADC3XXX_GPIO_PINS; + + ret = regmap_read(adc3xxx->regmap, ADC3XXX_MICBIAS_CTRL, ®val); + if (ret) + return ret; + return ((regval >> adc3xxx_micbias_shift[micbias]) & ADC3XXX_MICBIAS_MASK) != + ADC3XXX_MICBIAS_OFF; + } ret = regmap_read(adc3xxx->regmap, adc3xxx_gpio_ctrl_reg[offset], ®val); if (ret) return ret; @@ -1049,7 +1083,7 @@ static void adc3xxx_init_gpio(struct adc3xxx *adc3xxx) * This allows us to set up things which are not software * controllable GPIOs, such as PDM microphone I/O, */ - for (gpio = 0; gpio < ADC3XXX_GPIOS_MAX; gpio++) { + for (gpio = 0; gpio < ADC3XXX_GPIO_PINS; gpio++) { unsigned int cfg = adc3xxx->gpio_cfg[gpio]; if (cfg) { @@ -1061,9 +1095,15 @@ static void adc3xxx_init_gpio(struct adc3xxx *adc3xxx) } } - /* Set up micbias voltage */ + /* Set up micbias voltage. */ + /* If pin is configured as GPO, set off initially. */ for (micbias = 0; micbias < ADC3XXX_MICBIAS_PINS; micbias++) { - unsigned int vg = adc3xxx->micbias_vg[micbias]; + unsigned int vg; + + if (adc3xxx->micbias_gpo[micbias]) + vg = ADC3XXX_MICBIAS_OFF; + else + vg = adc3xxx->micbias_vg[micbias]; regmap_update_bits(adc3xxx->regmap, ADC3XXX_MICBIAS_CTRL, @@ -1091,8 +1131,19 @@ static int adc3xxx_parse_dt_gpio(struct adc3xxx *adc3xxx, return 0; } -static int adc3xxx_parse_dt_micbias(struct adc3xxx *adc3xxx, - const char *propname, unsigned int *vg) +static int adc3xxx_parse_dt_micbias_gpo(struct adc3xxx *adc3xxx, + const char *propname, + unsigned int *cfg) +{ + struct device *dev = adc3xxx->dev; + struct device_node *np = dev->of_node; + + *cfg = of_property_read_bool(np, propname); + return 0; +} + +static int adc3xxx_parse_dt_micbias_vg(struct adc3xxx *adc3xxx, + const char *propname, unsigned int *vg) { struct device *dev = adc3xxx->dev; struct device_node *np = dev->of_node; @@ -1383,16 +1434,28 @@ static int adc3xxx_i2c_probe(struct i2c_client *i2c) dev_dbg(dev, "Enabled MCLK, freq %lu Hz\n", clk_get_rate(adc3xxx->mclk)); } + /* Configure mode for DMDIN/GPIO1 pin */ ret = adc3xxx_parse_dt_gpio(adc3xxx, "ti,dmdin-gpio1", &adc3xxx->gpio_cfg[0]); if (ret < 0) goto err_unprepare_mclk; + /* Configure mode for DMCLK/GPIO2 pin */ ret = adc3xxx_parse_dt_gpio(adc3xxx, "ti,dmclk-gpio2", &adc3xxx->gpio_cfg[1]); if (ret < 0) goto err_unprepare_mclk; - ret = adc3xxx_parse_dt_micbias(adc3xxx, "ti,micbias1-vg", &adc3xxx->micbias_vg[0]); + /* Configure mode for MICBIAS1: as Mic Bias output or GPO */ + ret = adc3xxx_parse_dt_micbias_gpo(adc3xxx, "ti,micbias1-gpo", &adc3xxx->micbias_gpo[0]); + if (ret < 0) + goto err_unprepare_mclk; + /* Configure mode for MICBIAS2: as Mic Bias output or GPO */ + ret = adc3xxx_parse_dt_micbias_gpo(adc3xxx, "ti,micbias2-gpo", &adc3xxx->micbias_gpo[1]); + if (ret < 0) + goto err_unprepare_mclk; + /* Configure voltage for MICBIAS1 pin (ON voltage when used as GPO) */ + ret = adc3xxx_parse_dt_micbias_vg(adc3xxx, "ti,micbias1-vg", &adc3xxx->micbias_vg[0]); if (ret < 0) goto err_unprepare_mclk; - ret = adc3xxx_parse_dt_micbias(adc3xxx, "ti,micbias2-vg", &adc3xxx->micbias_vg[1]); + /* Configure voltage for MICBIAS2 pin (ON voltage when used as GPO) */ + ret = adc3xxx_parse_dt_micbias_vg(adc3xxx, "ti,micbias2-vg", &adc3xxx->micbias_vg[1]); if (ret < 0) goto err_unprepare_mclk;