From patchwork Fri Jun 7 15:22:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricard Wanderlof X-Patchwork-Id: 13690387 Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on2045.outbound.protection.outlook.com [40.107.247.45]) (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 49DB118732F; Fri, 7 Jun 2024 15:22:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.247.45 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717773744; cv=fail; b=GmKfiyHMRUPpVQKdiWpNUwUyKUyTkch/QzXUB34aH5gYewg42yKSHzGsQl6BTdQUfkhLULaVZ80adHLacDFjprNcgyT7DCix/u1svcEctSZ6UzW7gI1hvry/QD5tvISSEDa2QNt4yvdjTYYBqM3y575gtBWDRJThVal+mfmFXKE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717773744; c=relaxed/simple; bh=PoBbEyhaFxLC78gBUQwE8bFvnM5RB6hFEAjwIX6Dz4o=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=X2ByEeuow/2BQJvaCe1qIjnfMZ5b6qH3aDm2i8/xbICgxuarKsKInsdWCuzRtPpqT4V4dbBgALNXyyd4aULOldajfY/7+xpxRrN8kFdLAkUBHlZhDC8b/cla0b7SfUE447FUuAxsrZAQvte+pvqyfdPluYF9np4EAlQCy2M89VQ= 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=qEhQiVIH; arc=fail smtp.client-ip=40.107.247.45 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="qEhQiVIH" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=C5N2KGSGu/XUvgj/DWSdt83yXyb6LqDL9S+g7m4UxG0OkI9hCkdmlFFpqEDU/yIldfEz6r08ptvbtbXEOZkYNVQeIqyguPR/X1eHHk4ryvwtrspJ9jIOTz0bUpQUaXusx48TsMwxd8jmRiw9s7BPY2Q1BHyJhwQtnzfLCSxQPzycgfT+hrcr/LE7PtBEHuRVSnK8pXxZGxjtXIdXV3dGjUXYx3s3890hCR3lb2Ra2a8iLi1DyMGOEfPVDTRJfZAI3aSloIeZ3HvT4cGZm68aoeIMUwaoUbC8Uw0JYIIXGQzwsT3UR2YkTJAQKvd+02BlZkVQfsdkH6vXPnVWyXE4tQ== 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=q7PWeh6WCakgE+Fy8XUxlEUsg0m0AHqI4L91GShTGJc=; b=bUdipaA4eke2rogS/bzT4TFLLN2AgV5A+32otHOYrneApz4gEPzlcc/vD7OK/+gwEm+Kz7oNP3IS01n9/3Il1zA2blS6Hinc86O4lbZgiJDiXyeucXRIIVyIRQLJ0/nToUp47xJP3NaIpuFZ4sy360nzjTZ6M1fvMWzke9eIq8Owrrl8eaqeN3FKhYWedvZsNa8U4EJ+C9FKhIJosjsC8wMFQg51dM6uMSPbXZqxbi43UKOAF/DairDgGlxR19+k1fntwSob/mla5nqfreBJ/Usv77CDyRAzoGVD6AH5nhE1WKHXZWxjh2gmuHaglshuCjJfRxEyMP6qfS5YigiY7A== 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=q7PWeh6WCakgE+Fy8XUxlEUsg0m0AHqI4L91GShTGJc=; b=qEhQiVIHdnLHCkpkF0sft0kGvNUeADNgVhHYy0dld8SXAYX9qpBU+rSopQoY4xTCLja3ZxGgl1hmdX2ddvOd5ENNFCPmEeaivZwX3TcbAiLyi/nmzE2B5d8S2RFjU+1In0IVF1ckl/8a+2keIo34IpgA/tydBWy3z23O2MmZcpc= Received: from DB7PR03CA0087.eurprd03.prod.outlook.com (2603:10a6:10:72::28) by GV1PR02MB11108.eurprd02.prod.outlook.com (2603:10a6:150:210::12) 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 15:22:17 +0000 Received: from DB5PEPF00014B99.eurprd02.prod.outlook.com (2603:10a6:10:72:cafe::4f) by DB7PR03CA0087.outlook.office365.com (2603:10a6:10:72::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7656.21 via Frontend Transport; Fri, 7 Jun 2024 15:22:17 +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 DB5PEPF00014B99.mail.protection.outlook.com (10.167.8.166) 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 15:22:17 +0000 Received: from SE-MAILARCH01W.axis.com (10.20.40.15) 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 17:22:15 +0200 Received: from se-mail02w.axis.com (10.20.40.8) by SE-MAILARCH01W.axis.com (10.20.40.15) 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 17:22:14 +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 17:22:14 +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 DF73B3495; Fri, 7 Jun 2024 17:22:14 +0200 (CEST) Received: by pc49102-2217.se.axis.com (Postfix, from userid 9470) id C32326476FDB; Fri, 7 Jun 2024 17:22:14 +0200 (CEST) From: Ricard Wanderlof Date: Fri, 7 Jun 2024 17:22:04 +0200 Subject: [PATCH v3 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-v3-1-59dbec8b98f4@axis.com> References: <20240607-tlv320adc3xxx-micbias-gpo-v3-0-59dbec8b98f4@axis.com> In-Reply-To: <20240607-tlv320adc3xxx-micbias-gpo-v3-0-59dbec8b98f4@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: DB5PEPF00014B99:EE_|GV1PR02MB11108:EE_ X-MS-Office365-Filtering-Correlation-Id: 4871573a-56d8-457f-2bf3-08dc87059ddb 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?7cLNKrSZsLAxQZpPXo723CCeQKjB4bo?= =?utf-8?q?s+5JZJ0RpevWNSmQ9sCrSCgRRlMAqsFHpRWN7bNKuicGmaIQecoVq0ZiRDL5+GGCA?= =?utf-8?q?sZblNktGzDr8K18JoiFYfcCfrC/HkA9W54VFDtTlPpoCxWJ5EVIqIeuPndyXusQSD?= =?utf-8?q?OoustKlTqbPQRPTWpG/P2fhGBz+QXFAJjJLalBG9q/TXilvKf2D0/d4H1034FYJ8f?= =?utf-8?q?kr0jRsN+h4FcoNlCASZ5ASn5AW+JQyw39JRao5YmE7107uV8CywYEGhJz4sD3CTMQ?= =?utf-8?q?oCA79MvUe1sLgyFVrDhItVGrgPDKVuBSFrxTi0pJy+IZtIcw5lvSsJmIyePLy/n/R?= =?utf-8?q?PnTqH4B7lYAU2AMpL6LzUFRPZzVH8L5e+JhULASJ69T2eTpDbZfEHdM67rRn4uWJ+?= =?utf-8?q?36beIWEwgnMbH80Poiwfk9uQjFIBAwYcM+UhONVZfB2k6ycRySyHXNZJJheWT9q3J?= =?utf-8?q?cDEodbZUUAxVZbEexWmL+TrbFNsayqrTEkAoeDzOqLF6ciouj17n0J53VH+gLwrTw?= =?utf-8?q?hnEUmmw+lVCAG8k+Eb6bzRWaeghIRPuYPsm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;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 15:22:17.1959 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4871573a-56d8-457f-2bf3-08dc87059ddb 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: DB5PEPF00014B99.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1PR02MB11108 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 Reviewed-by: Krzysztof Kozlowski --- .../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..1a6c6877b2f7 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-gpo: ['ti,micbias1-vg'] + ti,micbias2-gpo: ['ti,micbias2-vg'] + required: - compatible - reg From patchwork Fri Jun 7 15:22:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricard Wanderlof X-Patchwork-Id: 13690385 Received: from EUR02-VI1-obe.outbound.protection.outlook.com (mail-vi1eur02on2085.outbound.protection.outlook.com [40.107.241.85]) (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 93B2A1DFC5; Fri, 7 Jun 2024 15:22:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.241.85 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717773742; cv=fail; b=qtx5h54nwjRVuxdludF/7mI0LUyerdW5Zf64rCzDt0fxdpgzbmNI8iezb9/d8ibgi09F+ilOlFNCv67yCkIsaNM2NByolhRMGbAL3vCRpD2Zm2wNE2wm+Xmu1KCMsWCVExoYQuoYHtBNVy8s5UoGed+tbendVAPbLOg5AgLJSI8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717773742; c=relaxed/simple; bh=2ETKfb8VK13PTpYLFe3lnJNuwIXowCxaZWOea5Pv7io=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=Yb9AYPk/NtLi2k9TuDalZEE7eQpL0BQeqR+OI8dvlCp30XWLTxobtESklNKeOssJfwd3Wpdj6gIR+oqYJ08vzlS8oRvcWohOpjbnFuf4J0wS/4LvAOatBUVOk1e+xrASZPP8th/aGbKHhoZdcVERdA1+rMLKrFbBRrR3Vukqo/s= 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=ZoUkNxqy; arc=fail smtp.client-ip=40.107.241.85 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="ZoUkNxqy" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LoM3MLwhGx2xp64BYekPQYnVsl4qV7mukjG/uozhua5Q1DsZ99Au+y4rCgnN+NwCMaOuLGKMHCyZgm8znWNvyfVSXvj6y64ThBi1MaDKzlBLyt6kGv8KJZFmRmVXQ/OKY7NWuIZMrW0QkynUTKq+VRKv02L01morOylPaz4tJx532Z8fhbfB8IN+ic7TvHcQcsKwUL5TLJPwOP/pYdXvOSMNVPCPpp3G3o7zk+SLi/P2og8d5Yucv7A5Nk2gywoZdbB+14T4fk8jMBxftfEdqdfo7rU/xcNkfS7OwVOaRR6s3YVt3iG3mnDBxirPYfu58cEOXdHUSGNbO4mqmkUQ3g== 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=KhCB1l5HWZRGbPP3y4bSc2fVR37GNuzepXFL3mF+LiNMW/yE91xohdea6F7UwQdr72CNK8e+qWoizgZoOj0OGoQr0tsG8gFHqVH34xAjc3FE9sh3VMqikiRlDEBbGsiBUnjEDtav8jtbbzyBCrlEfqs7d3jcODeixNekP2xZFkGcmpan7C0o+NeDPJzGnLctBR9QiGiWc84m9e5ZagE0mnH1LlMyTJnLmYRfPkdrcEauy0+s1UcuIXW44GtmIP6/TAes/zCa7e/Bvxva+6qXZz80sND+6iEgquJkkxqVvybY7H190c+fforq2prxS4WV274CbLM8gPP3vJHxuRxZjw== 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=ZoUkNxqyXUChs5M6TZfLKck8xTSZKikoRLgook/SMGBRj8Q0rw/jOaOpzHIPaKu8346fIG6IqmkL1WKRmt7MWOgQDGlOyxHNYkzDVerx3Ohyn6S036mQ2ZmSVoOnY6W+Oz1Sg93MiNnGhN4wWASA9Dx73WMZ+DMw2ul9DRAX3MI= Received: from AS9PR06CA0773.eurprd06.prod.outlook.com (2603:10a6:20b:484::28) by AM7PR02MB6273.eurprd02.prod.outlook.com (2603:10a6:20b:1b7::9) 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 15:22:15 +0000 Received: from AM3PEPF00009B9E.eurprd04.prod.outlook.com (2603:10a6:20b:484:cafe::58) by AS9PR06CA0773.outlook.office365.com (2603:10a6:20b:484::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7656.20 via Frontend Transport; Fri, 7 Jun 2024 15:22:15 +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 AM3PEPF00009B9E.mail.protection.outlook.com (10.167.16.23) 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 15:22:15 +0000 Received: from se-mail02w.axis.com (10.20.40.8) by se-mail02w.axis.com (10.20.40.8) 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 17:22:14 +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 17:22:14 +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 E0CA334A3; Fri, 7 Jun 2024 17:22:14 +0200 (CEST) Received: by pc49102-2217.se.axis.com (Postfix, from userid 9470) id C53B56476FDE; Fri, 7 Jun 2024 17:22:14 +0200 (CEST) From: Ricard Wanderlof Date: Fri, 7 Jun 2024 17:22:05 +0200 Subject: [PATCH v3 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-v3-2-59dbec8b98f4@axis.com> References: <20240607-tlv320adc3xxx-micbias-gpo-v3-0-59dbec8b98f4@axis.com> In-Reply-To: <20240607-tlv320adc3xxx-micbias-gpo-v3-0-59dbec8b98f4@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: AM3PEPF00009B9E:EE_|AM7PR02MB6273:EE_ X-MS-Office365-Filtering-Correlation-Id: 2f4f23c9-4c62-4a6b-1cff-08dc87059caf X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|7416005|82310400017|1800799015|376005|36860700004|921011; X-Microsoft-Antispam-Message-Info: =?utf-8?q?criahRJfZNYAYjGI9Fka+gtKszyIK7E?= =?utf-8?q?ybK8TnfXVniAsZrPVNU8sd2H+Fk0GkMkNEUfDWWuY3LiRJJVGIKIoSGLv1+Qwrw+d?= =?utf-8?q?DG7gvR7QERlMglK45guwlTLneVYjO/a78d8HzNt5V2b36KxTrERN+GRRSZSj6IMU8?= =?utf-8?q?vmUCeAArdpnMog5bwk24wFwAo5PA1Z4J4jrtLk57QFuT0xwjXtlD/fz9ZlMDO/Ev+?= =?utf-8?q?Yjdpl/kPpy73Ai22nVxtTZiBXo5Kh6yEXBCsfocIMWgjXgG+v2xlTNwVw7BXnEVoC?= =?utf-8?q?PGnzGY5W2EWbnRJ2Uphg3ou6ZgGW4RZ2fT6u9YyOeP1nBozdaYq0FM0YFRdVs0U29?= =?utf-8?q?m6Y6JTh3/eOSXVjMFTPyRYgE1bC9CVUnTreJPfnt352kOQ8dA6YMVAZ6kZx/Ha8wY?= =?utf-8?q?fE6b4/hLMiH39w4/Pv5DhG9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BQLmAldUJL1uSAn/BvYMHCAyRui9uBKXtZN12?= =?utf-8?q?tZ8QzwqNZjQjNAKUp9GCIzdlLDFA/ZUjzbYq2OAyiEXX0kTyxmZZ8Fo=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)(7416005)(82310400017)(1800799015)(376005)(36860700004)(921011);DIR:OUT;SFP:1101; X-OriginatorOrg: axis.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2024 15:22:15.2607 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2f4f23c9-4c62-4a6b-1cff-08dc87059caf 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: AM3PEPF00009B9E.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR02MB6273 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;