From patchwork Sat May 25 13:28:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artur Weber X-Patchwork-Id: 13674016 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 5D349C25B78 for ; Sat, 25 May 2024 13:28:33 +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=1qy98kYdbkTsfFKSe1boycxg75LDLNts4+3lTaefUic=; b=azHh47Y42xliM7 zuZnwh2cCOm+5PnJGzzdxks6r1r9z7Ih/GSpA04dQewMF13Kpq6oz8tuvG9zyMmjNLwRJFzhtbsaS jstJJg8Jjym9MdUrdV6WA3oNXfw9cBp/Gm2gC6OwbeF15p48sxKCuwgRBu75FQQfgZMe1/IwJvg6s UvjHXL8+wPA06AiiZwf3J3JaSfBzFhNd9DmPsRwBttrzLKQCKjKMpsfxZwrrHpiCF4KlkejGlRQso 6yZ+w6qb6jd8T4vXoMzBRJLbWOIjes5TlfSDqFGklB8nTmPShDm/r98VK6ebSfO+auzrd6Nq/wriT xgI5Im/oBaKn6Isv0YNQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sArRX-0000000B48N-2zNn; Sat, 25 May 2024 13:28:15 +0000 Received: from mail-ed1-x534.google.com ([2a00:1450:4864:20::534]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sArRT-0000000B463-3zUX for linux-arm-kernel@lists.infradead.org; Sat, 25 May 2024 13:28:13 +0000 Received: by mail-ed1-x534.google.com with SMTP id 4fb4d7f45d1cf-578626375ffso1326276a12.3 for ; Sat, 25 May 2024 06:28:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716643687; x=1717248487; 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=Mo8+1mx/nA30VwrcIjP4AOPt1PugmzRzdV+Mta/P/KY=; b=Z1LHspOcKqPfKpde6KT+B+3eO317YFQlrL+y/FXFq1T/u+aIsy1EDEkp/m+PbQWYhA rsRrPPRS0Zb/1bVS+a79f+PmAsAcR9kIo+w6sB5l9joLRmb4kzHUCV15xjb2rkC+ipLp RiCWECIWw8pr/aLhjPdDkWo3Dj30wcTdKf+JzhS0/6XiwOs9HNlpmcqgkNOixEjYACiP hBAuYmfcihs1kSquoGEChHxuViTJ9CXkP9i1ZIef/Li7XyYH+/qSUGNljEeM07gUFNQA Tj39F2kuGqSYgGpCLaeqRpkk4qW2FDoVCxsa2pL+Qim+3MrH7F90EHXBr6ZmSUWcxK3/ l1cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716643687; x=1717248487; 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=Mo8+1mx/nA30VwrcIjP4AOPt1PugmzRzdV+Mta/P/KY=; b=fguWvdUKtWRptVJqbEYPFEbckYt+nryR7wgsc4c20hHWbc1pz7W9fi5Er+dlcREE4c Cfrl4mI3ZdgSghx+gBqrHbXmjaJeOvlTKAYOcdTaRnbeUpmtegZLSY1XDzEF0C304bRu iuSEMzNwieQHQughnvC63jQ9ughRL8CBERdk+qmErRib++FnqIXWSwsVLJXg6dM6hTkG 1D0fr9UL6TTDe4J0gNsg74buGCVWdLj514tdRyZ0heBfl9IXF/79h6EXTjBtA453yaE/ dTu77aWpyPTTMV/6xl0jYZ3w4bkKFDL6BRLdtmdHGC+BL12dbm1Pf99Bx/kHmh/4CS4k SHZQ== X-Forwarded-Encrypted: i=1; AJvYcCU29XRZvMut/XoVCnMW5pvCcNocyMP3g86M+wPH0qCHHKGN0fVklJOmbU3YcJlykic6C/1cK6pyNIgbf0dawR6jTW2xJJHLW0Qh7aCb0ip1vzdgimg= X-Gm-Message-State: AOJu0YyyF/MEb0qyws8CFPyjIoKGrDfDCnP7IWfVGdY01erLZSxP3vvh hPbRSnnvcyockJ7G/0BOjLBgZBXWiykyJ19wLHX5wboSMBqk0rSN X-Google-Smtp-Source: AGHT+IE3gmJUIvul4S1O2zw/h8rOZCXQEQULnqDXXH8/XuEr0PvPCteVwNCcdD28vdmFGEI5XQNy4Q== X-Received: by 2002:a17:906:48d8:b0:a59:a7b7:2b8e with SMTP id a640c23a62f3a-a62643e0787mr323899366b.29.1716643686789; Sat, 25 May 2024 06:28:06 -0700 (PDT) Received: from hex.my.domain (83.8.128.191.ipv4.supernova.orange.pl. [83.8.128.191]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a626cda46e1sm251842566b.196.2024.05.25.06.28.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 May 2024 06:28:06 -0700 (PDT) From: Artur Weber Subject: [PATCH v4 0/9] ASoC: samsung: midas-audio: Add GPIO-based headset jack detection Date: Sat, 25 May 2024 15:28:04 +0200 Message-Id: <20240525-midas-wm1811-gpio-jack-v4-0-f488e03bd8c7@gmail.com> MIME-Version: 1.0 X-B4-Tracking: v=1; b=H4sIAGTnUWYC/3XNTQrCMBCG4atI1kYySUyrK+8hLppJ2o7aHxqpS undTQtCFbp8P5hnBhZ8Rz6w42Zgne8pUFPH0NsNwzKrC8/JxWZSSC32QvKKXBb4s4IUgBctNfy a4Y1bEFIaC4lHZPG47XxOrxk+X2KXFB5N957/9DCtX1KtkT1wwX2KzllnErT5qagyuu+wqdhE9 nLJpKuMjIzVThl0QqLx/4xaMHBYZVRkBEKiDGiN4ocZx/EDd8zgKEoBAAA= 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=1716643685; l=3607; i=aweber.kernel@gmail.com; s=20231030; h=from:subject:message-id; bh=4zLRKryEPEhLxtkijn6RbgJhMMJkRIFlKDleLaNwm/A=; b=lzS2mNI5ljRanb1yQ0vamjZSFmy4b2nQZa2vjTwXuGZWExrbMpjflCts+SmNj5dVCDUH3E5rg KYPnEJ0mCskCVn7yrDhQ8xurQgoxPydl+59q6OdsOXxiyIy1A3xjv1t 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-20240525_062812_056329_FFF0534E X-CRM114-Status: GOOD ( 14.34 ) 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 v4: - Replaced manual regulator toggles with SND_SOC_DAPM_REGULATOR_SUPPLY, both for existing mic bias regulators and for the new headset mic bias regulator - Link to v3: https://lore.kernel.org/r/20240519-midas-wm1811-gpio-jack-v3-0-0c1736144c0e@gmail.com 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 (9): 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: Use SND_SOC_DAPM_REGULATOR_SUPPLY for bias regulators 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 | 348 +++++++++++++++++---- 4 files changed, 343 insertions(+), 71 deletions(-) --- base-commit: a38297e3fb012ddfa7ce0321a7e5a8daeb1872b6 change-id: 20240502-midas-wm1811-gpio-jack-b10226b17ecc Best regards,