From patchwork Sun May 19 08:17:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artur Weber X-Patchwork-Id: 13667813 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 74B09C25B75 for ; Sun, 19 May 2024 08:18:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:MIME-Version:Message-Id:Date: Subject:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=QQ5A9ZSfTCQFHxL45Bxbl9a8DQUIG76sBMID9/syyMQ=; b=Lw/GiVxK4r+h7+ /KOBgeeP5xohuCIHm5NJ6Xgjpq9bqFi3uKhRZiLRGPEjKHF7yoWtPZnLJAwoXl7sf3Facaa2U9wN7 G2VmGuaWA5gPJFRXA53nZehokAJUpjm+31sBp9gYef3lVrzkuf1SWAEaeJTISXsfH/e1P8ASqPGK7 rFidpW7YU9Xb+vTD8OqRmnhCSyPMjHplwnkxZstlNho/wrB6yNeYmJKSv7iurNKSXc6jlb2rIWJdx zDl6byf1W38FQ0GN9ByvdZAwdIf2oBCA35YTwHmI3wXA8PHig9W/y2p7PaD58SXJ10MuisqyoJRFK 9X73DsJ2nI/sWA1lpL1Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s8bkL-0000000Bcub-126H; Sun, 19 May 2024 08:18:21 +0000 Received: from mail-ed1-x529.google.com ([2a00:1450:4864:20::529]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s8bkG-0000000BcrU-2sqv for linux-arm-kernel@lists.infradead.org; Sun, 19 May 2024 08:18:19 +0000 Received: by mail-ed1-x529.google.com with SMTP id 4fb4d7f45d1cf-572c65cea55so10511639a12.0 for ; Sun, 19 May 2024 01:18:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716106688; x=1716711488; darn=lists.infradead.org; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:from:to:cc:subject:date:message-id:reply-to; bh=Vw+eqC8qYyRv3MIYCjMkS6Jwy9w22sYSmCr6FUkRoZQ=; b=B36c974kBmQO3OWViOnrSsVsgSw/N1Iq6hcbl5wlL2jlGhi9I9yBZw68dMo8ciIvi3 uA6/Ujb/EJYLOwaMZSiuVZgilPQaBWcdMgW3/vF/rndU6U4x+JFID+nLIY3YBHPTwcxx bcce8J5BHkeDNzb10su8Q+wJfhx2GM/EhQzMD2OTbWDQaLaMUcNKD2eUYiN+ku+yCVJX +csAHFTa2vrHZVc2UgiRen2hfBPrHEaXlKASTfX/o1SfP3DrBQO4A+U/0mVWlGA2Ucab c8yTlFauo/yGsh6qzHB15RS25+742CEIH4rGiqswJjAFe/5VmgSBLa5PchmMRRcZsp7s Fp6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716106688; x=1716711488; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Vw+eqC8qYyRv3MIYCjMkS6Jwy9w22sYSmCr6FUkRoZQ=; b=ONiqQMoaWujCSVXdaIWoDXsuh5C/UF+st0HsMHnD0GFEr0DewRtA5I+ITHYJx3zvX2 ZTnqT4xEQIA8bu/I4QIGmuY2nDLQn3pUrI9a0i0pgo+hs4eQ1r/w8a0rqj+xCJd2Alu0 pAVLEvrhtTUziAsmtgH65YP/fwDMgtVYl6GMFA0M1PSKXS6dV7f48ngs0GlF+55suO+F 8Dfa5ijQyJo7FVlOnIknBRF8DtnhXdPW0Chj6zO8sp8E8+BJ8+CXd6Ov3GGOn3YkW8Bb CwbVEmOZ+Saozr3B5OV4LTVGshWfvyAz5KrkfUT3tSl0gT0larQU/rkq/EjvBBrx7tb+ OuYg== X-Forwarded-Encrypted: i=1; AJvYcCVjEhIQAyvREHLonzKMN6fXqNr56e+eeSIX9UunpfGZX66ZbLBpkdULaXOwQnsfX1EUicr8ZykWCXyQDwTURWVS6cJBRH/gHFRN8ML8VKYS5VBjYF0= X-Gm-Message-State: AOJu0YzlFTByJnR7PE6eADiccIHFVZX6kwInV323hTz5lvsCXrtyk3LF zpQDLTpCkKpp8OJdzGEoLPsYQcOWei/cv11Mxh93iCeV+YNgx5SG X-Google-Smtp-Source: AGHT+IFTKZlj4vaDpbFg3ISEA24rKauu3cUeaZy4+4egT5W58uNnkMk5KIUOqtmg4LEoq7V+gTWqYA== X-Received: by 2002:a05:6402:2695:b0:575:2c30:fe60 with SMTP id 4fb4d7f45d1cf-5752c30ffa6mr2896233a12.10.1716106688326; Sun, 19 May 2024 01:18:08 -0700 (PDT) Received: from hex.my.domain (83.8.125.62.ipv4.supernova.orange.pl. [83.8.125.62]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5733c34e5ccsm13698518a12.95.2024.05.19.01.18.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 May 2024 01:18:07 -0700 (PDT) From: Artur Weber Subject: [PATCH v3 0/8] ASoC: samsung: midas-audio: Add GPIO-based headset jack detection Date: Sun, 19 May 2024 10:17:46 +0200 Message-Id: <20240519-midas-wm1811-gpio-jack-v3-0-0c1736144c0e@gmail.com> MIME-Version: 1.0 X-B4-Tracking: v=1; b=H4sIAKq1SWYC/3XN0Q6CIBTG8VdxXEcDNHRd9R6tCzigngpx0Kjmf PfQrc0bL//fdn5nItEGtJGci4kEmzCiH3KUh4JAr4bOUjS5iWCiYicmqEOjIn073nBOuxE9vSt 4UM2ZEFLz2gKQfDwG2+Jnha+33D3Glw/f9U/iy/onyz0yccqobcAYbWQNur10TuHzCN6RhUxiy zS7jMiMrkwpwTAB0m6ZeZ5/MwkqeAMBAAA= To: Sylwester Nawrocki , Krzysztof Kozlowski Cc: Liam Girdwood , Mark Brown , Rob Herring , Conor Dooley , Jaroslav Kysela , Takashi Iwai , Alim Akhtar , alsa-devel@alsa-project.org, linux-sound@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, Artur Weber X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1716106686; l=3238; i=aweber.kernel@gmail.com; s=20231030; h=from:subject:message-id; bh=vOmrQBJAdvlGhlh3IQuJFC5nzf12tuwIUaUkDgVZRHA=; b=8XirlovSgTFuyZInY7Ney+LFvrii3NLSjBFIG6JDVzAN3bhN/OId1rINWfUWRG1PFIHDFLUdO lmlBKecojj/BNO4y0F+SmsaVzGnzByslst8HeezuK6mh6DPNsON2UNI X-Developer-Key: i=aweber.kernel@gmail.com; a=ed25519; pk=RhDBfWbJEHqDibXbhNEBAnc9FMkyznGxX/hwfhL8bv8= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240519_011817_004202_9F170329 X-CRM114-Status: GOOD ( 14.22 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Many of Samsung's Exynos 4 devices share the same midas-audio driver to handle the codec setup. While most of these devices, including the Midas itself, use the jack detection provided by the WM8994 driver, other devices such as the Samsung Galaxy Tab 3 8.0 (lt01) use two GPIOs and an ADC channel to determine jack insertion, the jack's type, and button presses (for headsets with volume up/down/play buttons). In the downstream kernel, this behavior is implemented in the sec-jack driver[1], and the per-device settings are configured in *-jack.c files in the mach folder (see e.g. the Tab 3's implementation[2]). This patchset implements this mechanism in the midas_wm1811.c driver, and adds new DTS options to allow for its configuration. It also enables jack detection for the Samsung Galaxy Tab 3 8.0. A very similar mechanism was already present in the aries_wm8994.c driver[3]; this implementation heavily borrows from it, though there are a few extra cleanups as well. Signed-off-by: Artur Weber [1] https://github.com/gr8nole/android_kernel_samsung_smdk4x12/blob/lineage-14.1/drivers/misc/sec_jack.c [2] https://github.com/gr8nole/android_kernel_samsung_smdk4x12/blob/lineage-14.1/arch/arm/mach-exynos/tab3-jack.c [3] https://github.com/torvalds/linux/blob/master/sound/soc/samsung/aries_wm8994.c --- Changes in v3: - Re-added pipe (|) character to samsung,headset-button-threshold-microvolt description to prevent it from being parsed as a mapping (fixes syntax error) - Split out "ASoC: dt-bindings: samsung,midas-audio: Add GPIO-based headset jack detection" into two patches - Link to v2: https://lore.kernel.org/r/20240508-midas-wm1811-gpio-jack-v2-0-b4d36cd02c6e@gmail.com Changes in v2: - Added vendor prefix to threshold properties - Added separate headset mic bias regulator - Changed some cases of dev_err + return with return dev_err_probe - Added an extra patch to replace some previous dev_err + return cases with dev_err_probe - Moved tab3 DTS wm1811 codec config changes to separate commit --- Artur Weber (8): ASoC: dt-bindings: samsung,midas-audio: Add headset mic bias supply ASoC: dt-bindings: samsung,midas-audio: Add GPIO-based headset jack detection ASoC: samsung: midas_wm1811: Add headset mic bias supply support ASoC: samsung: midas_wm1811: Add GPIO-based headset jack detection ASoC: samsung: midas_wm1811: Use dev_err_probe where appropriate ARM: dts: samsung: exynos4212-tab3: Fix headset mic, add jack detection ARM: dts: samsung: exynos4212-tab3: Add MCLK2 clock to WM1811 codec config ARM: dts: samsung: exynos4212-tab3: Drop interrupt from WM1811 codec .../bindings/sound/samsung,midas-audio.yaml | 33 ++ arch/arm/boot/dts/samsung/exynos4212-tab3.dtsi | 31 +- sound/soc/samsung/Kconfig | 2 +- sound/soc/samsung/midas_wm1811.c | 343 +++++++++++++++++++-- 4 files changed, 379 insertions(+), 30 deletions(-) --- base-commit: e67572cd2204894179d89bd7b984072f19313b03 change-id: 20240502-midas-wm1811-gpio-jack-b10226b17ecc Best regards,